Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Karman

#32
también puede hacer algo como esto, agregas esta función:

typedef enum _MINIDUMP_TYPE {
 MiniDumpNormal                           = 0x00000000,
 MiniDumpWithDataSegs                     = 0x00000001,
 MiniDumpWithFullMemory                   = 0x00000002,
 MiniDumpWithHandleData                   = 0x00000004,
 MiniDumpFilterMemory                     = 0x00000008,
 MiniDumpScanMemory                       = 0x00000010,
 MiniDumpWithUnloadedModules              = 0x00000020,
 MiniDumpWithIndirectlyReferencedMemory   = 0x00000040,
 MiniDumpFilterModulePaths                = 0x00000080,
 MiniDumpWithProcessThreadData            = 0x00000100,
 MiniDumpWithPrivateReadWriteMemory       = 0x00000200,
 MiniDumpWithoutOptionalData              = 0x00000400,
 MiniDumpWithFullMemoryInfo               = 0x00000800,
 MiniDumpWithThreadInfo                   = 0x00001000,
 MiniDumpWithCodeSegs                     = 0x00002000,
 MiniDumpWithoutAuxiliaryState            = 0x00004000,
 MiniDumpWithFullAuxiliaryState           = 0x00008000,
 MiniDumpWithPrivateWriteCopyMemory       = 0x00010000,
 MiniDumpIgnoreInaccessibleMemory         = 0x00020000,
 MiniDumpWithTokenInformation             = 0x00040000
} MINIDUMP_TYPE;

typedef struct _MINIDUMP_EXCEPTION_INFORMATION {
 DWORD               ThreadId;
 PEXCEPTION_POINTERS ExceptionPointers;
 BOOL                ClientPointers;
} MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;

typedef struct _MINIDUMP_USER_STREAM {
 ULONG32 Type;
 ULONG   BufferSize;
 PVOID   Buffer;
} MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;

typedef struct _MINIDUMP_USER_STREAM_INFORMATION {
 ULONG                 UserStreamCount;
 PMINIDUMP_USER_STREAM UserStreamArray;
} MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;

typedef struct _MINIDUMP_CALLBACK_INFORMATION {
 PVOID CallbackRoutine;
 PVOID CallbackParam;
} MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;

typedef BOOL (WINAPI *MiniDumpWriteDump_t)(HANDLE, DWORD, HANDLE,MINIDUMP_TYPE,
 CONST PMINIDUMP_EXCEPTION_INFORMATION,
 CONST PMINIDUMP_USER_STREAM_INFORMATION,
 CONST PMINIDUMP_CALLBACK_INFORMATION
);

LONG WINAPI MiniDumper(struct _EXCEPTION_POINTERS *pExceptionInfo){
 LONG retval=EXCEPTION_CONTINUE_SEARCH;
 HMODULE hDll=LoadLibrary("dbghelp.dll");
 if(hDll){
   MiniDumpWriteDump_t MiniDumpWriteDump=(MiniDumpWriteDump_t)
   GetProcAddress(hDll,"MiniDumpWriteDump"));
   if(MiniDumpWriteDump){
     char szDumpPath[MAX_PATH];SYSTEMTIME sSystemTime;
     if(GetModuleFileName(NULL,szDumpPath,MAX_PATH)){
       char *pSlash=strrchr(szDumpPath,'\\');
       if(pSlash)*++pSlash=0;
     }else
       GetTempPath(MAX_PATH,szDumpPath);
     GetLocalTime(&sSystemTime);
     sprintf(szDumpPath,"%s%s_%02i_%02i_%04i__%02i_%02i_%02i.mdmp",szDumpPath,"MyProcess",sSystemTime.wDay,sSystemTime.wMonth,sSystemTime.wYear,sSystemTime.wHour,sSystemTime.wMinute,sSystemTime.wSecond);
     HANDLE hFile=CreateFile(szDumpPath,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
     if(hFile!=INVALID_HANDLE_VALUE){
       MINIDUMP_EXCEPTION_INFORMATION ExInfo;
       ExInfo.ThreadId=GetCurrentThreadId();
       ExInfo.ExceptionPointers=pExceptionInfo;
       ExInfo.ClientPointers=FALSE
       if(MiniDumpWriteDump(GetCurrentProcess(),GetCurrentProcessId(),hFile,MiniDumpNormal,&ExInfo,NULL,NULL))
         retval=EXCEPTION_EXECUTE_HANDLER;
       CloseHandle(hFile);
     }
   }
 }
 return retval;
}


y luego al principio de tu programa agregas:

SetUnhandledExceptionFilter(MiniDumper);

de esa forma cuando ocurra un error se generará un archivo que contendrá información del mismo (el cual lo puedes analizar con Windbg)...

S2
#33
un ejemplo (no probado) pero que en cualquier caso con ligeras modificaciones debería funcionar:

DWORD dExplorerPid;
HWND hExplorer=FindWindow("Progman",NULL);//explorer window class
if(hExplorer&&GetWindowThreadProcessId(hExplorer,&dExplorerPid)){
 HANDLE hExplorerProc=OpenProcess(PROCESS_ALL_ACCESS,FALSE,dExplorerPid);
 if(hExplorerProc){
   TerminateProcess(hExplorerProc,0);
   CloseHandle(hExplorerProc);
 }
}


S2
#34
Cita de: xkiz ™ en  1 Octubre 2011, 19:52 PMnunca pense que una ventanitta me iba a complicar tanto, @Karman  WM_WINDOWPOSCHANGING no la conocía, igual me hace un efecto medio raro, vah  aplicando eso igual se puede redimencionar la ventana.

Probaste desactivar el flag de redimencionamiento?

DWORD Style = (DS_MODALFRAME | WS_POPUP |  WS_THICKFRAME)&~WS_SIZEBOX;

S2
#35
fijate el mensaje WM_WINDOWPOSCHANGING


case WM_WINDOWPOSCHANGING:
    WINDOWPOS *pwp=(WINDOWPOS *)lParam;
    pwp->flags |= SWP_NOSIZE;
break;


S2
#36
Cita de: jhonatanAsm en 24 Septiembre 2011, 01:38 AMme siento obligado a decir algo:

un virus hecho en visual basic no es un virus "pituco" ??

saludos

un virus hecho en visual basic es casi un virus echo en Command Shell (.bat, etc...) :P

S2
#37
Cita de: xkiz ™ en 23 Septiembre 2011, 16:57 PM
mmmm.... tal vez me explique mal yo desde el principio, yo tengo  un String Table:
Código (cpp) [Seleccionar]

STRINGTABLE DISCARDABLE
BEGIN
    101                     "Rock & Pop"
END


la cual necesito cargarla en la barra de Titulo de una ventana, un item de un PopUpMenu y un Tooltip, como se ve en la imagen de aca abajo.


y porqué directamente no modificas tu stringtable(?)

S2
#38
Cita de: xkiz ™ en 22 Septiembre 2011, 15:08 PMbue, estoy armando un menú el cual saco los string de cada ítem desde el recursos, hasta ahí todo bien, el tema es que entre estos string hay uno que es "aaaa & bbb" por ejemplo, contiene un carácter "&" el cual no logro hacer visible entre el texto del menú.
se que estos caracteres como & van antecedidos por el carácter "\" para que sean visibles, pero ese mismo string lo uso como titulo de la ventana.

quien te dijo que tenes que agregarle "\" ? el caracter "&" no tiene nada especial... si no te aparece subrayado debe ser por otra cosa y con respecto a tu ejemplo:

Citar"aaaa & bbb"

eso no va a funcionar por el espacio en blanco... a lo sumo "aaaa &bbb".

esta es la función encargada de dibujar los strings en los menús: DrawTextEx

fijate la parte de DT_PREFIXONLY

S2
#39
Programación C/C++ / Re: Problema con control STATIC
22 Septiembre 2011, 04:30 AM
Cita de: Riki_89D en 21 Septiembre 2011, 16:12 PMHola que tal,intenot poner un color de fondo en un static,tengo 4 statics en la APP

si mirás la documentación del mensaje WM_CTLCOLORSTATIC:

CitarIf an application processes this message, the return value is a handle to a brush that the system uses to paint the background of the static control.

case WM_CTLCOLORSTATIC:
  if((HWND) lParam == GetDlgItem(Man,ID_SIMAGE1))
    return CreateSolidBrush(0x1d1c1c);


S2
#40
Cita de: anonime en  2 Septiembre 2011, 01:00 AMlo que no entiendo es que si outtextxy el tercercampo es para cadena...
Por que no me deja y se me cuelga haciendo esto por ejemplo:

fijate un ejemplo que tengo de cuando usé esa librería:

//Obtener Números
gprintf(90, 220,"Ingrese número:");
do{
  clearline(185,180);
  t=getnum(185,180);
  if(t<Xmin||t>Xmax)
    showerror();
}while(t0<Xmin||t0>Xmax);
//.....
double getnum(int x,int y){
  char tmp[256],*pt;
  int val,inc=0;
  double ret=0;
  pt=tmp;*pt=0;
  val=getch();
  while(val!=13){
    if(val>47&&val<58||val=='.'||(val=='-'&&!inc)){
      *(pt++)=(char)val;
      gprintf(x+inc,y,"%c",val);
      inc+=10;
    }
    if(val==8){
      if(pt!=tmp){
        inc-=10;
        gprintf(x+inc,y,"  ");
        *(--pt)=0;
      }
    }
    val=getch();
  }
  *pt=0;
  if(sscanf(tmp,"%lf",&ret))
  return ret;
}


S2