elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Sobre Crear pestañas CreateWindowExA etc
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Sobre Crear pestañas CreateWindowExA etc  (Leído 1,171 veces)
josue9243

Desconectado Desconectado

Mensajes: 67


Ver Perfil
Sobre Crear pestañas CreateWindowExA etc
« en: 31 Diciembre 2018, 21:51 pm »

Hola, queria saber porque tengo un problemita a la hora de utilizar CreateWindowExA.

Resulta que yo estaba creando una DLL que crea botones DENTRO de un programa externo, y lo hago de la siguiente forma:

El tema es que al CREAR este nuevo boton en el programa, resulta que ESTE BOTON UTILIZA EL WNDPROC DE EL PROGRAMA Y EXPLOTA TODO Y NO USA EL DE MI DLL, queria saber si alguien sabe como realizar esto que quiero de la forma correcta.

(CABE DESTACAR QUE EL BOTON SE CREA TODO, PERO AL APRETARLO EXPLOTA T2)

Código:
HWND hwnd;
LRESULT CALLBACK WndProc(HWND hwndMain, UINT uMsg, WPARAM wParam, LPARAM lParam);

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
)
{
if (ul_reason_for_call)
{
DisableThreadLibraryCalls(hModule);
DbgPrint("Injected1");
hwnd = FindWindowA( NULL, "MiProgramaExterno");
WNDCLASSEX windowClass;
windowClass.lpszClassName = L"Main Class";
windowClass.cbClsExtra = NULL;
windowClass.cbWndExtra = NULL;
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.hbrBackground = (HBRUSH) CreateSolidBrush(RGB(240,240,240));
windowClass.hCursor = LoadCursor(NULL,IDC_ARROW);
windowClass.hIcon = LoadIconA(hModule, "ICONO");
windowClass.hIconSm = LoadIconA(hModule, "ICONO");
windowClass.hInstance = hModule;
windowClass.lpfnWndProc = WndProc;
windowClass.lpszMenuName = NULL;
windowClass.style = CS_VREDRAW | CS_HREDRAW;
RegisterClassEx(&windowClass);
//(HINSTANCE)GetWindowLongW(hwnd, GWL_HINSTANCE)


/*HWND Main = CreateWindowExW(NULL,L"Main Class",L"nuevapestañaaldope",
  WS_OVERLAPPEDWINDOW | WS_VISIBLE,
  100,100,500,500,
  NULL,NULL,hModule,NULL);*/

MSG msg;
while(GetMessageW(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

return msg.wParam;
}
return TRUE;
}


LRESULT CALLBACK WndProc(HWND ahwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
{
HWND hwndButton = CreateWindowW( L"BUTTON", L"ok", WS_CHILD | WS_VISIBLE,10,10,100,100,hwnd,(HMENU)1,hModule, NULL);
}
break;
case WM_COMMAND:
{
if(LOWORD(wParam) == 1)
{
MessageBoxA( ahwnd, "qwe", 0, 0 );
}
}
case WM_PAINT:
{
PAINTSTRUCT Ps;
HDC hdc;
hdc= BeginPaint(ahwnd,&Ps);
// SetBkColor(hdc,RGB(0,0,0));
//SetTextColor(hdc,RGB(0,0,0));
// TextOut(hdc,200,150,L"Hello World!",12);

EndPaint(ahwnd,&Ps);
}
break;
case WM_CLOSE:
{
PostQuitMessage(WM_QUIT);
}
break;
default:
return(DefWindowProc(ahwnd,message,wParam,lParam));
}

return(0);
}


En línea

fary


Desconectado Desconectado

Mensajes: 1.062



Ver Perfil WWW
Re: Sobre Crear pestañas CreateWindowExA etc
« Respuesta #1 en: 1 Enero 2019, 19:35 pm »

Intenta con SubClassing  :)

https://docs.microsoft.com/en-us/windows/desktop/winmsg/about-window-procedures



En línea

Un byte a la izquierda.
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
pestañas
Diseño Gráfico
prosk8er 1 1,871 Último mensaje 29 Junio 2004, 17:24 pm
por Sub_Cero
Duda pestañas VB
Programación Visual Basic
-sagitari- 0 1,557 Último mensaje 7 Enero 2006, 18:35 pm
por -sagitari-
Pestañas en el Form
Programación Visual Basic
Hendrix 5 1,812 Último mensaje 12 Marzo 2006, 09:12 am
por NYlOn
Pestañas y aspectos
Programación Visual Basic
Wdeah 4 2,127 Último mensaje 11 Julio 2006, 20:15 pm
por soplo
Crear OCX de pestañas
Programación Visual Basic
aaronduran2 0 1,252 Último mensaje 2 Septiembre 2008, 22:22 pm
por aaronduran2
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines