i did a class for the timer precision using the timeSetEvent(). of course i can have more than 7 instances from the Timer class(with 200ms or something so small). is these a limitation or what? class Timer { private: static unsigned int TimerCount; UINT_PTR timerid; UINT m_uResolution=0; unsigned int TimerID=0; unsigned int intInterval=0; static void CALLBACK _TimerProc(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2) { Timer* obj=reinterpret_cast<Timer*>(dwUser); if(obj->timerprocedure!=nullptr) obj->timerprocedure(); } public: std::function<void()> timerprocedure=EmptyEvent; Timer(std::function<void()> tmrprocedure=EmptyEvent) { TimerCount++; TimerID=TimerCount-1; timerprocedure=tmrprocedure; } void Stop() { if(timerid!=0) { timeKillEvent(timerid); timeEndPeriod (m_uResolution); } } unsigned int GetInterval() { return intInterval; } void …

Member Avatar
+0 forum 0

Hi Dw. I'm new to C++ nor Win32 app dev. I want my app to stay open or running even if I'm not interacting with it. And how to write a close call. In VB to close it you just right: Close() How can I achieve these two? Also how to remove the title bar as well with those 3 buttons(minimize,maximize,close)?

Member Avatar
Member Avatar
+0 forum 1

i have my own region class: class region { private: BYTE* Get24BitPixels(HBITMAP pBitmap, WORD *pwWidth, WORD *pwHeight) { // a bitmap object just to get bitmap width and height BITMAP bmpBmp; // pointer to original bitmap info LPBITMAPINFO pbmiInfo; // bitmap info will hold the new 24bit bitmap info BITMAPINFO bmiInfo; // width and height of the bitmap WORD wBmpWidth, wBmpHeight; // --------------------------------------------------------- // get some info from the bitmap // --------------------------------------------------------- GetObject(pBitmap, sizeof(bmpBmp),&bmpBmp); pbmiInfo = (LPBITMAPINFO)&bmpBmp; // get width and height wBmpWidth = (WORD)pbmiInfo->bmiHeader.biWidth; wBmpWidth -= (wBmpWidth%4); // width is 4 byte boundary aligned. wBmpHeight = (WORD)pbmiInfo->bmiHeader.biHeight; // copy …

Member Avatar
+0 forum 0

I'm learning win32 programming from [Here](http://www.functionx.com/win32/Lesson03.htm) and I have problem in part of tutorial about string table it gives me this error: Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention. Here is mycode: //--------------------------------------------------------------------------- #include <windows.h> #include "resource.h" //--------------------------------------------------------------------------- char AppCaption[40]; LRESULT CALLBACK WndProcedure(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); //--------------------------------------------------------------------------- INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG Msg; HWND hWnd; …

Member Avatar
Member Avatar
+0 forum 1

Using the Python win32 extensions it is relatively simple to copy to and from the clipboard. Sorry. the Windows OS is a requirement.

Member Avatar
+0 forum 0

It's been a long while since I've been here. I am trying to use Win32 IEAutomation to automate IE to login to SharePoint, read some information, download some files and some other junk. I installed WIN32 IEAutomation. When I run the simple script: use Win32::IEAutomation; my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1); $ie->gotoURL('http://www.google.com'); I get "Could not start AutoItX3 Control through OLE". I have googled this and all of the solutions that I can find don't work. I modified WinClicker to specify where the AutoItX3.dll is - no go. I installed all of AutoIt - no go. …

Member Avatar
Member Avatar
+0 forum 2

I'm trying to do the following: 1. get username typed into the userField 2. make a SEARCH mysql_query with the username as a variable I'm having a hard time getting past phase 2 since mysql_query takes a const char* as the query string, and I can only get username as char* or wchar_t* I'm also compiling in unicode. My code for now: void mysql_connect(HWND hLoginWnd) { MYSQL *con, mysql; MYSQL_RES *res; mysql_init(&mysql); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, "utf8"); mysql_real_connect(&mysql, "localhost", "root", "", "treenitaulu", 3306, NULL, 0); char name[512], pass[512]; int lenUser = SendMessage(userField, WM_GETTEXT, 512, (LPARAM)name); int lenPass = SendMessage(passField, WM_GETTEXT, 512, (LPARAM)pass); …

Member Avatar
Member Avatar
+0 forum 1

Hey everyone, I am working on a win32 project right now and I have a few buttons that I wanted to change how they look so I gave them the BS_OWNERDRAW property and drew them myself. Now sense I am using ownerdraw there is no visual indication of when someoone hovers over the button and/or clicks it. So I want to make the button turn slightly transparent when someone hovers over it. Does anyone know what I should do to achieve this? Thanks!

Member Avatar
Member Avatar
+0 forum 3

How to know the name of process in the other process? or who started that process.

Member Avatar
Member Avatar
+0 forum 3

In my program the commands are on left hand side , I want to move thses buttons to middle of window on click of mouse. I wrote this code n=but buttons are disappearing. Any solution case WM_LBUTTONDOWN: RECT buttonScreenRect; GetWindowRect(hButton, &buttonScreenRect); POINT buttonClientPoint; //buttonClientPoint.x = hButton.left; buttonClientPoint.x = buttonScreenRect.left; buttonClientPoint.y = buttonScreenRect.top; ScreenToClient(hButton, &buttonClientPoint); //MoveWindow(hButton,cxClient/2,cyClient/2,333,212,true); //MoveWindow(hButton, 50, buttonClientPoint.y, buttonScreenRect.right - buttonScreenRect.left, buttonScreenRect.bottom - buttonScreenRect.top,true); MoveWindow(hButton, 150, buttonClientPoint.y/2, buttonScreenRect.right - buttonScreenRect.left, buttonScreenRect.bottom - buttonScreenRect.top, true); return 0;

Member Avatar
+0 forum 0

How to create a rubber banding line using the left-mouse button in win 32?

Member Avatar
Member Avatar
+0 forum 2

Write a minimal terminal emulator which will basically just transmit all characters typed on the keyboard to the serial port and display all characters received via the serial port. Include a set of menu items that will allow a user to:  Select, modify or set the communication parameters such as port number, bit rate, number of data bits, number of stop and start bits, and parity (i.e., “command mode”).  Enter “connect mode”. In this mode, the application goes into a loop in which the keyboard is monitored; when a key is typed, the character is sent to the …

Member Avatar
Member Avatar
+0 forum 3

I want to create two textboxes on my window. I used this code case WM_CREATE: hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("edit"), TEXT("sending"), WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER | ES_LEFT, 15, 15, 200, 300, hwnd, NULL, NULL, NULL); hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("edit"), TEXT("Receiving"), WS_CHILD | WS_VISIBLE | WS_BORDER, 220, 15, 100, 300, hwnd, NULL, NULL, NULL); break; It shows only one window. What is the problem?

Member Avatar
Member Avatar
+0 forum 5

Hey everyone. I am working on learning how to make some different controls with win32 and at the moment I amt trying to make a combobox with small images next to each option. However when I run my code the options are there but the images are missing. Can anyone help me out with this? I will post the important parts of my code here and a link to a pastebin of the full code at the bottom: **define's, include's, and global variables:** #define _WIN32_WINNT 0x0600 #define _WIN32_IE 0x0900 #include <windows.h> #include <commctrl.h> #include <Tchar.h> #define IDC_BUTTON_1 101 #define IDC_EDIT_1 …

Member Avatar
Member Avatar
+0 forum 1

So I was working on my computer and everything was fine and then all of a sudden it restarts itself and i get this error about the win32 file. It tells me that my computer cant boot because of a missing or corrupr win32 file and to use yhe repair option on my windows xp installation disk to fix it. So i think this will be an easy fix and i pull out my disk and force my computer to boot from it. I press R for repair and 1 for the windows program and then it askes me for …

Member Avatar
Member Avatar
+0 forum 5

I am writing a pure C based win32 applications. I have drawn line. Now i want to translate that line, move the line whereved user wants to move on screen. Then again I drawn another line, I am drawing multiple lines. I have created rectangle region for each line and trying to move the line. When I move the 2nd line over the 1st line on screen the 1st line is getting wiped out. Because I am InvalidateRect() of the rect for the line being moved, so when that rectangle is crossing the other line then the other line is …

Member Avatar
Member Avatar
+0 forum 1

hi ı have an exam can you give some examples about win32 especially main part of programme thnks

Member Avatar
Member Avatar
+0 forum 2

I need some help with this one. i have a few code samples I have found on the internet, however, when I attempt to use them I get errors, and nothing really works. What I'm trying to do is get the text of a message box, and the contents of the message. Can anyone please help with sample code? I would appreciate it. ./amvx86

Member Avatar
Member Avatar
+0 forum 4

Ok, so I'm not having a problem but I didn't know where else to place this question. I'm just now "re-learning" C++, I never got into GUI programming before and it's been almost 4 years since I last touched this language. Anyways, my question is simply, do you code a GUI or do you design it? What I mean by this is, there are a lot of tools out there with a nice design view of what you're doing. You can drag and drop buttons onto a window, you can drag and drop a browserController and a bunch of other …

Member Avatar
Member Avatar
+0 forum 3

Hey everyone, I hate posting in forums asking people for help, and then searching for hours and wanting to throw my computer out the window because I can never seem to find the resources I need for programming. I feel that in vb 6 everything was well documented and now here in 2010 it's harsh and nothing is well documented. Can anyone suggest books on win32 api programming? Or, any books on vb 2010 API programming at all? I would appreciate it more than being answered in the forms and posting every time I have a problem. Regards, amvx86

Member Avatar
Member Avatar
+0 forum 5

Hi, I have to open and read multiple files which are in same folders. I can search and collect the whole size of those files. But the problem is with when I'm copying the files to a buffer. How can I read the multiple files? I'm using this example for checking the multiple files. I can get the size but can't seem to open and read. Any ideas? I'm using this example for searching the files: http://msdn.microsoft.com/en-us/library/aa365200%28v=vs.85%29.aspx

Member Avatar
Member Avatar
+0 forum 3

Hey guys, I am having a problem where i want to print a image and a simple string. i would want that when i print i get this on paper : [Click Here For Image](http://img339.imageshack.us/img339/9308/wiw.png) I looked up printDocument, printDialog and printPreviewControl from MSDN and got a few examples but i did not really understand them, i looked up this topic on Google but its very little discussed. I don't know the procedure on how to print to paper so if someone can explain to me how its done it would be very appreciated or if you can make an …

Member Avatar
Member Avatar
+0 forum 1

Hello everyone. I would like to know if it is possible to double buffer a .png image using GDI+ Can anyone help me? Below is the code I used to display a png image with alpha transparency, however, I do not know how to double buffer it! Please help. DrawPng (HDC hdc, HINSTANCE hinstance, HWND hwnd, int curbitmapvalue, int posX, int posY) { HRSRC hRsrc; hRsrc = FindResource(hinstance, MAKEINTRESOURCE(curbitmapvalue), "PNG"); HGLOBAL hImage; hImage = LoadResource(hinstance, hRsrc); LPVOID pImage; pImage = LockResource(hImage); HGLOBAL hBlock; IStream *pStream=NULL; int size= SizeofResource(hinstance, hRsrc); hBlock=GlobalAlloc(GHND, size); LPVOID pBlock; pBlock = GlobalLock(hBlock); memmove(pBlock,pImage, size); CreateStreamOnHGlobal(hBlock, FALSE, …

Member Avatar
Member Avatar
+0 forum 1

Hello everyone I am trying to make a app. witch uses windows that pop-up if a button is pressed. the problem is, i don't know how to make more than one window. Can anyone tell me how to do that? I am using Microsoft Visual Studio 2010 Express, in a Win32 file.

Member Avatar
Member Avatar
+0 forum 8

I got win32 application, that runs a infinite for loop, which increment a value inside the loop. the problem am having is that my application become unresponsive and uses alot of CPU when compiled. case IDM_ROTATION: for(int i = 0; i < 4; i++) { i = 0; rotation += rotationIncrement; InvalidateRect(hWnd, NULL, TRUE); UpdateWindow(hWnd); } break; How can i fix this?, I just want a loop or timer that increment my rotation variable every second.

Member Avatar
Member Avatar
+0 forum 4

i'm trying to create a splitmenu but haven't found any tutorial, i would like to know after creating a splitmenu button with createwindow function, how to populate the menu and what will be the change in switch case of callback function?

Member Avatar
Member Avatar
+0 forum 3

Circuit, [Circuit Diagram](https://picasaweb.google.com/116591322380497799116/December52012#) Video: [Video](http://www.youtube.com/watch?v=qGoM_ydAtBc)

Member Avatar
+0 forum 0

Hello everyone, I am working my way through the Forger's Win32 tutorial and am on the "Creating a Simple Application" part currently. I am using C++ (instead of C in the tutorial) and the WinGW compiler. When I compile the below code I get this error: main.cpp: In function 'LRESULT WndProc(HWND, UINT, WPARAM, LPARAM)': main.cpp:26:47: error: invalid conversion from 'HGDIOBJ {aka void*}' to 'HFONT' [-fpermissive] If I change the line to a cast: hfDefault = (HFONT)GetStockObject(DEFAULT_GUI_FONT); The error changes to: undefined reference to 'GetStockObject@4' collect2: ld returned 1 exit status I have searched around on Google and haven't found a …

Member Avatar
Member Avatar
+0 forum 3

Hi everybody! I am having some trouble running a detached process using CreateProcess function in C++. I have been using the following function to spawn processes in c++ for years now havnig no trouble. I have used it with console applications, mfc apps, dialog based ... etc : StartProc(char *callprogram, bool blshow) { //callprogam = full path to executable //blshow = show or hide application's window STARTUPINFO startInfo; PROCESS_INFORMATION procInfo; DWORD creationFlags; startInfo.cb = sizeof(STARTUPINFO); startInfo.lpReserved = NULL; startInfo.lpDesktop = NULL; startInfo.lpTitle = NULL; startInfo.dwFlags = STARTF_USESHOWWINDOW; if (blshow==true) startInfo.wShowWindow = SW_SHOW; else startInfo.wShowWindow = SW_HIDE; startInfo.cbReserved2 = 0; startInfo.lpReserved2 …

Member Avatar
Member Avatar
+0 forum 1

Hi I tried creating sftp server using OpenSSH and I get some errors. First I tried on Microsoft Windows Server 2003, R2, SP1 and then on Windows XP Professional, SP2 and the error is same. Installation went smoothly on both the OS (after a few complications, see note at bottom), but when I tried to start the service, I get the following error: [QUOTE]Could not start the OpenSSH server service on local computer. Error 193: 0xc1.[/QUOTE] Here is the log of error from EventViewer (System) [QUOTE]The OpenSSH Server service failed to start due to the following error: OpenSSH Server is …

Member Avatar
Member Avatar
+0 forum 1

The End.