Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

Dev578

@Dev578
About
Posts
45
Topics
32
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Win32 Application
    D Dev578

    I am using the Win32 API to create an application to assist in making a custom .font file format for a game I am making. It is a SDI application. Although my question may seem simple, I was unable to find anyway of doing it, or maybe searching for the wrong thing, I don't know. Anyway, I want to be able to programatically change the size of the window, at run time. I have a title bar, menu, and borders, and I don't want to have them included when resizing. By that I mean, for example, I wanted to resize the window to 500 pixels by 500 pixels, the white space in between (not including) the menu and borders would be 500 pixels by 500 pixels. Also, I want to disable the user from resizing the application. Anyone have any ideas? Thank you -Dev578

    C / C++ / MFC question game-dev algorithms json tutorial

  • Problem with SetWindowsHookEx()
    D Dev578

    I'm not so sure why, but when I commented out the MessageBox in the main program, it did not crash. It installed and removed the hook successfully (to my knowledge). I have another problem though. With the hook installed, if I try to open another program, like Internet Explorer or some kind of software, Windows Crashes. It freezes and then all my icons dissappear and the taskbar goes away, leaving only the background and the cursor. Anyone have any idea why this would be happening? Any help is appreciated. Thanks in advance -Dev578

    C / C++ / MFC help c++ database tutorial

  • Problem with SetWindowsHookEx()
    D Dev578

    I am trying to inject a dll into all running processes so I can hook all calls to CreateProcess(). I am going to intercept all calls to CreateProcess() by modifying the IAT, I know how to do that. My problem is injecting the dll into all processes using SetWindowsHookEx(). This is my code, it runs once or twice (triggering the MessageBox function in the main program), and then if you run it again, the computer freezes (and doesn't trigger the MessageBox function in the main program, meaning it got stuck on the InjectEnable() function). If anyone knows what the problem is, that would be highly appreciated. // Main program: #include //windows header #include //stdio header #include "MyDLL.h" #pragma comment(lib,"MyDLL.lib") int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { InjectEnable(); // Function in MyDLL.dll, enables injection MessageBox(NULL,"End Application","Notification",MB_OK); InjectDisable(); // Function in MyDLL.dll, disables injection return 0; } // DLL cpp file: #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include // Windows header #include "MyDLL.h" // Global variables (shared) #pragma data_seg (".shared") HHOOK g_hHook = 0; #pragma data_seg () #pragma comment(linker,"/SECTION:.shared,RWS") // Global variables (unshared) HINSTANCE hDll; BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: { hDll = (HINSTANCE)hModule; break; } case DLL_THREAD_ATTACH: { break; } case DLL_THREAD_DETACH: { break; } case DLL_PROCESS_DETACH: { break; } default: break; } return TRUE; } LRESULT HookProc ( int code, // hook code WPARAM wParam, // virtual-key code LPARAM lParam // keystroke-message information ) { return ::CallNextHookEx(g_hHook, code, wParam, lParam); } bool MYDLL_API InjectEnable() { g_hHook = SetWindowsHookEx( WH_CBT, (HOOKPROC)HookProc, hDll, NULL ); if( g_hHook == NULL ) { return false; } return true; } bool MYDLL_API InjectDisable() { UnhookWindowsHookEx( g_hHook ); g_hHook = NULL; // Send a broadcast message, this forces the hook to trigger, and thus unload SendMessage(HWND_BROADCAST,WM_NULL,0,0); return true; } // DLL header file: #ifdef MYDLL_EXPORTS #define MYDLL_API __d

    C / C++ / MFC help c++ database tutorial

  • How to tell what dlls are mapped into a process
    D Dev578

    I have my dll injected into another process. Is there a way from that dll that I can tell what other dll's are mapped into the process, and be able to get the module handle to one of them? Any help is appreciated. -Dev578

    C / C++ / MFC help tutorial question

  • Problem with OpenProcess
    D Dev578

    Here is the function: HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,WindowProcessID); WindowProcessID is a DWORD. How do I get the Process ID of a window for use in the third parameter of OpenProcess()? Any help is appreciated. -Dev578

    C / C++ / MFC help question

  • Problem with FindWindow
    D Dev578

    I want to get the HWND of a window by FindWindow(). The second parameter is the window name, but the window name I am trying to get has a copyright symbol in it (a c with a circle around it). Is there a way that I can have FindWindow() only search for the first few characters in the window name? or is there a way to put a copyright symbol in a string? Any help is appreciated. -Dev578

    C / C++ / MFC help question

  • hooking problem
    D Dev578

    I am having trouble with the "Process-wide api spying" article by Anton Bassov. Here is the code: HMODULE hMod = GetModuleHandle("kernel32.dll"); if (hMod == NULL) MessageBox(NULL,"could not load dll","error",MB_OK); else { IMAGE_DOS_HEADER * dosheader=(IMAGE_DOS_HEADER *)hMod; IMAGE_OPTIONAL_HEADER * opthdr =(IMAGE_OPTIONAL_HEADER *) ((BYTE*)hMod+dosheader->e_lfanew+24); IMAGE_IMPORT_DESCRIPTOR * descriptor=(IMAGE_IMPORT_DESCRIPTOR*)(BYTE*)hMod + opthdr->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress; while(descriptor->FirstThunk) { char*dllname=(char*)((BYTE*)hMod+ descriptor->Name); IMAGE_THUNK_DATA* thunk=( IMAGE_THUNK_DATA*)((BYTE*) hMod + descriptor->OriginalFirstThunk); int x=0; while(thunk->u1.Function) { char*functionname=(char*)((BYTE*) hMod + ( DWORD)thunk->u1.AddressOfData+2); MessageBox(NULL,functionname,"function",MB_OK); DWORD *IATentryaddress=( DWORD *)((BYTE*) hMod + descriptor->FirstThunk)+x; x++; thunk++; } descriptor++; } } It is crashing at run-time, saying that it cannot read from desciptor. Anyone have any idea what the problem is? Any help is appreciated. -Dev578

    C / C++ / MFC help json question

  • static function
    D Dev578

    I have a static function inside a class. It is actually a seperate thread, so it has to be static. Is there a way that I can access normal members of the class from the static thread funcion? Any help is appreciated. -Dev578

    C / C++ / MFC help question

  • Multithreading problem in Win32
    D Dev578

    I am trying to create the thread inside a class: class ThreadClass { public: //... bool StartThread(); DWORD WINAPI ThreadFunc( LPVOID lpParam ); //... }; bool ThreadClass::StartThread() { DWORD dwThreadId, dwThrdParam = 1; HANDLE hThread; hThread = CreateThread( NULL, // default security attributes 0, // use default stack size ThreadFunc, // thread function &dwThrdParam, // argument to thread function 0, // use default creation flags &dwThreadId); // returns the thread identifier return true; } DWORD WINAPI ThreadClass::ThreadFunc( LPVOID lpParam ) { //do whatever here return 0; } this produces this error: error C2664: 'CreateThread' : cannot convert parameter 3 from 'DWORD (LPVOID)' to 'LPTHREAD_START_ROUTINE' Any ideas why it is doing this / how to fix it? Any help is appreciated. -Dev578

    C / C++ / MFC help question

  • Multithreading problem in Win32
    D Dev578

    When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578

    C / C++ / MFC help question

  • convert float to int without rounding
    D Dev578

    How would one convert a float to an int without rounding it? Currently: float f = 1.9; int i = (int)f; i would equal 2. How do I get it to not round, and have i equal 1 in the above example? Any help is appreciated. -Dev578

    C / C++ / MFC question help tutorial

  • Handling Minimize event
    D Dev578

    I have made a window in Win32. I would like to somehow handle the minimize event, so I can do stuff when the user clicks the minimize button. Does anyone have any clue how to do this? Any help is appreciated. -Dev578

    C / C++ / MFC help tutorial question

  • Running a program in the taskbar
    D Dev578

    I am making a Win32 project in VC++ v7. When I click on the executable, I want it to run in the task bar. How would I do this? Any help is appreciated. -Dev578

    C / C++ / MFC c++ help question

  • Writing a scripting language
    D Dev578

    I have run into some problems while trying to write a scripting language in VC++ 7. I want it to all be in an edit box. For example, if the user types this in the edit box: String MyString = "Hello"; if (MyString == "Hello") sendkeys(Hello); else MoveMouse(160,480); end; Quite a pointless program, but I am having a hard time handling it with C++. How do I handle the boolean logic, and how would I get both of the parameters of the MouseMove function. I would like the program to execute from the top to the bottom. Anyone have any idea how to do this? I just need the basic idea of how to do it. Any help would be appreciated:) -Dev578

    C / C++ / MFC tutorial question c++ help

  • Problem with Win32
    D Dev578

    I made an empty Win32 project in VC++ v7, and then added a C++ file to it. I made an exact copy of one of the Direct3D working tutorials and pasted it into the empty C++ file. I copied all of the DirectX include files and library's into the directories tbat VC++ uses. When I try to build it, it gives me the following errors: Linking... AnotherOne.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "long __cdecl InitD3D(struct HWND__ *)" (?InitD3D@@YAJPAUHWND__@@@Z) AnotherOne.obj : error LNK2019: unresolved external symbol _D3DXCreateTextureFromFileA@12 referenced in function "long __cdecl InitGeometry(void)" (?InitGeometry@@YAJXZ) AnotherOne.obj : error LNK2019: unresolved external symbol _D3DXLoadMeshFromXA@32 referenced in function "long __cdecl InitGeometry(void)" (?InitGeometry@@YAJXZ) AnotherOne.obj : error LNK2019: unresolved external symbol _D3DXMatrixPerspectiveFovLH@20 referenced in function "void __cdecl SetupMatrices(void)" (?SetupMatrices@@YAXXZ) AnotherOne.obj : error LNK2019: unresolved external symbol _D3DXMatrixLookAtLH@16 referenced in function "void __cdecl SetupMatrices(void)" (?SetupMatrices@@YAXXZ) AnotherOne.obj : error LNK2019: unresolved external symbol _D3DXMatrixRotationY@8 referenced in function "void __cdecl SetupMatrices(void)" (?SetupMatrices@@YAXXZ) AnotherOne.obj : error LNK2019: unresolved external symbol __imp__timeGetTime@0 referenced in function "void __cdecl SetupMatrices(void)" (?SetupMatrices@@YAXXZ) Debug/AnotherOne.exe : fatal error LNK1120: 7 unresolved externals Yes, I named the project "AnotherOne," this is because of several attempts:) If anyone could help me out, that would be great. -Dev578

    C / C++ / MFC help c++ graphics game-dev debugging

  • IOCTL
    D Dev578

    Awile ago, I had asked how to read the binary off of a CD. Alexander said that I would have to use an "IOCTL" (Thanks for your reply Alexander). Sorry, I am still quite new to MFC... What exactly is an IOCTL? Alexander said that the IOCTL to use is IOCTL_CDROM_RAW_READ. I think I have it defined in a header file called ntddcdrm.h. IOCTL_CDROM_RAW_READ is not a function, so I am assuming I need to use it in a function or something? If anyone could help me out, that would be great. Any help is apprectiated. -Dev578

    C / C++ / MFC c++ help tutorial question

  • Reading binary data off a CD
    D Dev578

    To my understanding, a CD has 0's and 1's (binary) written on it, and a laser reads the binary. Then the computer translates it. Please correct me if I am wrong. I am using MFC, and what I am trying to do is get all the binary data off of a CD, and put it to a char. Is this possible? Any help at all is appreciated. -Dev578

    C / C++ / MFC c++ help question

  • Trouble with GetLogicalDrives() function
    D Dev578

    As said before, what I am tying to do is get the letters of all the CD/DVD drives on the users computer using MFC. This is what I have so far: DWORD Drives = GetLogicalDrives(); CString FormatString; FormatString.Format("%i",Drives); DriveControl.SetWindowText(FormatString); FormatString returns 61... I have no idea why it is returning 61. I am assuming that I am doing it wrong? If anyone could show me how to do this right, that would be great. -Dev578

    C / C++ / MFC c++ tutorial question

  • Displaying a list of CD/DVD drives
    D Dev578

    I am using MFC, how would I go about finding and displaying all of the CD/DVD drives of the users computer? I have been looking around for articles, and have not found anything yet. Any help is appreciated. -Dev578

    C / C++ / MFC c++ help question

  • Retrieving all the written data off of a CD
    D Dev578

    I am using MFC with Visual Studio 2003. Is there a way to retrieve all of the written data off of a CD, and save it as a file? I don't know weather or not copy protection is going to be an issue, and I am assuming that this is not going to be an easy thing to do, so any help at all is appreciated:) -Dev578

    C / C++ / MFC help csharp c++ visual-studio question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups