• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sipping
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Page 1 of 2 12 LastLast
    Results 1 to 10 of 12

    Thread: C++ win32 API

    1. #1
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      guru's Avatar
      Join Date
      Jun 2012
      Posts
      117
      Thanks (-->)
      7
      Thanks (<--)
      21

      C++ win32 API

      How to Manual Map DLL
      Hi guys,
      This is a s**t i tried now. Eventhough i did exactly what was given in the tutorial, it shows error. Even copy and paste didn't work! I can even handle very big process but this fu*king c++ and win32 is fu*king me always. Any tutorial or any book what ever fu*k i use it results in error even i follow all the steps. Moreover, even after copy paste work it shows error. This is pathetic!

      [spoiler]#include &lt;Windows.h&gt;
      const char sz_WindowName&#91;]="TEST application";
      LRESULT CALLBACK WndProc(HWND hwnd,UINT msg, WPARAM wparam,LPARAM lparam){
      switch(msg)
      {
      case WM_DESTROY:
      PostQuitMessage(0);
      break;
      case WM_CLOSE:
      DestroyWindow(hwnd);
      break;
      default:
      return DefWindowProc(hwnd,msg,wparam,lparam);
      }
      return 0;
      }

      int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
      {
      WNDCLASSEX wc;
      HWND hwnd;
      MSG msg;
      wc.cbSize=sizeof(WNDCLASSEX);
      wc.style=0;
      wc.hInstance=hInstance;
      wc.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);
      wc.lpszMenuName=NULL;
      wc.lpszClassName=sz_WindowName;
      wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
      wc.hCursor=LoadCursor(NULL,IDC_ARROW);
      wc.cbClsExtra=0;
      wc.lpfnWndProc=WndProc;
      if(!RegisterClassEx(&amp;wc))
      {
      MessageBox(NULL,"NOte!","class registration failed",MB_OK);
      return 0;
      }
      hwnd=CreateWindowEx(0,(LPCWSTR)sz_WindowName,(LPCW STR)sz_WindowName,WS_OVERLAPPEDWINDOW,10,10, 640,480,NULL,NULL,hInstance,NULL);
      if(hwnd==NULL)
      {
      MessageBox(NULL,(LPCWSTR)"Sorry",(LPCWSTR)"Window creation failed",MB_OK);
      return 0;
      }
      ShowWindow(hwnd,nCmdShow);
      UpdateWindow(hwnd);
      while(GetMessage(&amp;msg,NULL,0,0)&gt;0)
      {
      TranslateMessage(&amp;msg);
      DispatchMessage(&amp;msg);
      }

      }[/spoiler]

    2. #2
      Founder
      Learning to hack games!
       
      Pawning
       
      Fleep's Avatar
      Join Date
      May 2012
      Posts
      622
      Thanks (-->)
      208
      Thanks (<--)
      752
      First calm down guru your not gonna make much progress this way, its probably just a small mistake.
      On a first look that code works fine, tell us as much as you can. Can you compile it?, if not then where and what are your errors?

      Fleep

    3. #3
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      P4R4D0GS's Avatar
      Join Date
      Aug 2012
      Posts
      13
      Thanks (-->)
      0
      Thanks (<--)
      0
      Watch and learn. Iam not good in English so I can not explain what you have wrong. But there u have working code.
      Try to compare with your code certainly u find what is wrong. Next time u can tell us compile errors.

      Code:
      #include &lt;windows.h&gt;
      
      LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
      
      int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                PSTR szCmdLine, int iCmdShow)
      {
        TCHAR szAppName&#91;] = TEXT("WindowName");
        HWND hWnd;
        MSG msg;
        WNDCLASSEX wc;
        
        wc.cbSize = sizeof(wc);
        wc.style = CS_HREDRAW | CS_VREDRAW;
        wc.lpfnWndProc = WndProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hInstance;
        wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
        wc.hIconSm = NULL;
        wc.hCursor = (HCURSOR)LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
        wc.lpszMenuName = NULL;
        wc.lpszClassName = szAppName;
        
        RegisterClassEx(&amp;wc);
        
        hWnd = CreateWindowEx(0,szAppName,
                  szAppName,
                  WS_OVERLAPPEDWINDOW,
                  CW_USEDEFAULT,
                  CW_USEDEFAULT,
                  CW_USEDEFAULT,
                  CW_USEDEFAULT,
                  NULL,
                  NULL,
                  hInstance,NULL);
        ShowWindow(hWnd, iCmdShow);
        UpdateWindow(hWnd);
        
        while(GetMessage(&amp;msg, NULL, 0, 0))
        {
           TranslateMessage(&amp;msg);
           DispatchMessage(&amp;msg);
        }
        return msg.wParam;
      }
      
      LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
      {
          switch(message)
          {
           case WM_DESTROY:
           PostQuitMessage(0);
           return 0;
          }
          return DefWindowProc(hWnd, message, wParam, lParam);
      }

    4. #4
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      guru's Avatar
      Join Date
      Jun 2012
      Posts
      117
      Thanks (-->)
      7
      Thanks (<--)
      21
      Sorry Fleep! I wrote it when i was very angry that it didn't work. Actually, I can make hacks with c++. I use base code from other creators(It's copy and paste the base code to get win32 to windows and function. I just program the logic of core concept like aimbot, esp code and fix simple errors to make it work).

      Regarding this program, I get "cannot convert from 'const char[17]' to 'LPCWSTR' " and the same error occur when it comes to message box. Actually I got this program from this tutorial- www.winprog.org/tutorial/simple_window.html . Some variable names might have changed by me. But followed those steps. Why the hell is it that difficult even to create a simple window in win32 api?

      @P4R4DOGS: Thanks for your help! I will check with that code and try to find the error!

    5. #5
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      P4R4D0GS's Avatar
      Join Date
      Aug 2012
      Posts
      13
      Thanks (-->)
      0
      Thanks (<--)
      0
      Try to remove (LPCWSTR) from this:

      Code:
      hwnd=CreateWindowEx(0,(LPCWSTR)sz_WindowName,(LPCWSTR)sz_WindowName,WS_OVERLAPPEDWINDOW,10,10, 640,480,NULL,NULL,hInstance,NULL);
      and this:

      Code:
        if(hwnd==NULL)
        {
         MessageBox(NULL,(LPCWSTR)"Sorry",(LPCWSTR)"Window creation failed",MB_OK);
         return 0;
        }
      and check the part when u registering class.

      Code:
        wc.cbSize    = sizeof(WNDCLASSEX);
        wc.style     = 0;
        wc.lpfnWndProc  = WndProc;
        wc.cbClsExtra  = 0;
        wc.cbWndExtra  = 0;
        wc.hInstance   = hInstance;
        wc.hIcon     = LoadIcon(NULL, IDI_APPLICATION);
        wc.hCursor    = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
        wc.lpszMenuName = NULL;
        wc.lpszClassName = sz_WindowName;
        wc.hIconSm    = LoadIcon(NULL, IDI_APPLICATION);

    6. #6
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      guru's Avatar
      Join Date
      Jun 2012
      Posts
      117
      Thanks (-->)
      7
      Thanks (<--)
      21
      Quote Originally Posted by P4R4D0GS
      Try to remove (LPCWSTR) from this:

      Code:
      hwnd=CreateWindowEx(0,(LPCWSTR)sz_WindowName,(LPCWSTR)sz_WindowName,WS_OVERLAPPEDWINDOW,10,10, 640,480,NULL,NULL,hInstance,NULL);
      When i remove that (LPCWSTR) it shows a type cast error! That why i added it to type the char* to LPCWSTR. It removed the error but created a letters which i can't understand! In that tutorial which i have mentioned, the author didn't use LPCWSTR.

    7. #7
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      P4R4D0GS's Avatar
      Join Date
      Aug 2012
      Posts
      13
      Thanks (-->)
      0
      Thanks (<--)
      0
      So remove (LPCWSTR) and follow screenshots.

      Attached Thumbnails Attached Thumbnails 2.jpg   1.jpg   2.jpg   1.jpg  

    8. #8
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      guru's Avatar
      Join Date
      Jun 2012
      Posts
      117
      Thanks (-->)
      7
      Thanks (<--)
      21
      Ya! Got that fixed! 1st success! Thanks.

      But still i get only the failure message! Not able to create window!!!!!???

      RegisterClassEx() not able to register the window! Any fix for it! The debug console didn't say any thing about it.

    9. #9
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      P4R4D0GS's Avatar
      Join Date
      Aug 2012
      Posts
      13
      Thanks (-->)
      0
      Thanks (<--)
      0
      Check the part when u registering class

      Code:
        wc.cbSize    = sizeof(WNDCLASSEX);
        wc.style     = 0;
        wc.lpfnWndProc  = WndProc;
        wc.cbClsExtra  = 0;
        wc.cbWndExtra  = 0;
        wc.hInstance   = hInstance;
        wc.hIcon     = LoadIcon(NULL, IDI_APPLICATION);
        wc.hCursor    = LoadCursor(NULL, IDC_ARROW);
        wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
        wc.lpszMenuName = NULL;
        wc.lpszClassName = sz_WindowName;
        wc.hIconSm    = LoadIcon(NULL, IDI_APPLICATION);

    10. #10
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      guru's Avatar
      Join Date
      Jun 2012
      Posts
      117
      Thanks (-->)
      7
      Thanks (<--)
      21
      Cheat Engine Tutorials
      It works! wc.hIconsm fixed it. A blank window is now open! Thanks for the help man!
      Could you list which are the optional and compulsory attribute in the class structure when creating a window?

      Is it a myth?

    Page 1 of 2 12 LastLast