public Codigo_de_Ativacao(string dll) { InitializeComponent(); string SATDLL = dll; ptr = FuncoesDll.LoadLibrary(SATDLL); intptr_trocarCodigoDeAtivacao = FuncoesDll.GetProcAddress(ptr, "TrocarCodigoDeAtivacao"); trocarCodigoDeAtivacao = (TrocarCodigoDeAtivacao)Marshal.GetDelegateForFunctionPointer (intptr_trocarCodigoDeAtivacao, typeof(TrocarCodigoDeAtivacao)); }
public Configurar_Rede(string dll) { InitializeComponent(); string SATDLL = dll; ptr = FuncoesDll.LoadLibrary(SATDLL); intptr_ConfigurarInterfaceDeRede = FuncoesDll.GetProcAddress(ptr, "ConfigurarInterfaceDeRede"); configurarInterfaceDeRede = (ConfigurarInterfaceDeRede)Marshal.GetDelegateForFunctionPointer (intptr_ConfigurarInterfaceDeRede, typeof(ConfigurarInterfaceDeRede)); }
public void FuncoesDLL() { try { intptr_ConsultarSAT = FuncoesDll.GetProcAddress(ptr, "ConsultarSAT"); consultarSAT = (ConsultarSAT)Marshal.GetDelegateForFunctionPointer(intptr_ConsultarSAT, typeof(ConsultarSAT)); intptr_ConsultarStastusOperacional = FuncoesDll.GetProcAddress(ptr, "ConsultarStatusOperacional"); consultarStatusOperacional = (ConsultarStatusOperacional)Marshal.GetDelegateForFunctionPointer (intptr_ConsultarStastusOperacional, typeof(ConsultarStatusOperacional)); intptr_AtivarSAT = FuncoesDll.GetProcAddress(ptr, "AtivarSAT"); ativarSAT = (AtivarSAT)Marshal.GetDelegateForFunctionPointer (intptr_AtivarSAT, typeof(AtivarSAT)); intptr_AssociarAssinatura = FuncoesDll.GetProcAddress(ptr, "AssociarAssinatura"); associarAssinatura = (AssociarAssinatura)Marshal.GetDelegateForFunctionPointer (intptr_AssociarAssinatura, typeof(AssociarAssinatura)); intptr_TesteFimAFim = FuncoesDll.GetProcAddress(ptr, "TesteFimAFim"); testeFimAFim = (TesteFimAFim)Marshal.GetDelegateForFunctionPointer (intptr_TesteFimAFim, typeof(TesteFimAFim)); intptr_ExtrairLogs = FuncoesDll.GetProcAddress(ptr, "ExtrairLogs"); extrairLogs = (ExtrairLogs)Marshal.GetDelegateForFunctionPointer (intptr_ExtrairLogs, typeof(ExtrairLogs)); intptr_AtualizarSoftware = FuncoesDll.GetProcAddress(ptr, "AtualizarSoftwareSAT"); atualizarSoftware = (AtualizarSoftwareSAT)Marshal.GetDelegateForFunctionPointer (intptr_AtualizarSoftware, typeof(AtualizarSoftwareSAT)); intptr_DesbloquearSAT = FuncoesDll.GetProcAddress(ptr, "DesbloquearSAT"); desbloquearSAT = (DesbloquearSAT)Marshal.GetDelegateForFunctionPointer (intptr_DesbloquearSAT, typeof(DesbloquearSAT)); intptr_EnviarDadosVenda = FuncoesDll.GetProcAddress(ptr, "EnviarDadosVenda"); enviarDadosVenda = (EnviarDadosVenda)Marshal.GetDelegateForFunctionPointer (intptr_EnviarDadosVenda, typeof(EnviarDadosVenda)); intptr_CancelarUltimaVenda = FuncoesDll.GetProcAddress(ptr, "CancelarUltimaVenda"); cancelarUltimaVenda = (CancelarUltimaVenda)Marshal.GetDelegateForFunctionPointer (intptr_CancelarUltimaVenda, typeof(CancelarUltimaVenda)); intptr_BloquearSAT = FuncoesDll.GetProcAddress(ptr, "BloquearSAT"); bloquearSAT = (BloquearSAT)Marshal.GetDelegateForFunctionPointer (intptr_BloquearSAT, typeof(BloquearSAT)); intptr_ConsultarNumeroSessao = FuncoesDll.GetProcAddress(ptr, "ConsultarNumeroSessao"); consultarNumeroSessao = (ConsultarNumeroSessao)Marshal.GetDelegateForFunctionPointer (intptr_ConsultarNumeroSessao, typeof(ConsultarNumeroSessao)); MessageBox.Show("DLL carregada com sucesso"); grpBoxFuncoes.Enabled = true; return; } catch { MessageBox.Show("DLL importada não é uma dll SAT", "Erro", MessageBoxButtons.OK); txtImportarDLL.Text = ""; grpBoxFuncoes.Enabled = false; return; } }