Search Results

Search found 1778 results on 72 pages for 'win32'.

Page 3/72 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Win32 Event vs Semaphore

    - by JP
    Basically I need a replacement for Condition Variable and SleepConditionVariableCS because it only support Vista and UP. (For C++) Some suggested to use Semaphore, I also found CreateEvent. Basically, I need to have on thread waiting on WaitForSingleObject, until something one or more others thread tell me there is something to do. In which context should I use a Semaphore vs an Win Event? Thanks

    Read the article

  • [C#][Win32 API] PostMessage Help?

    - by Rudi
    I've looked at sites and MSDN documentation but I still don't understand the last parameter of PostMessage(). On forums in which people ask how to use PostMessage, people reply with one of two implementations: PostMessage(WindowHandle, WM_KEYDOWN, KeyCode, MapVirtualKey(KeyCode, 0) << 16); PostMessage(WindowHandle, WM_KEYDOWN, KeyCode, 0); What's the difference? Why can the last parameter be left as 0 in some instances, but has to be 'shifted' and all that in other instances? Just a quick question. Don't need essay replies (although they would be much appreciated). Any insight is appreciated. Thanks in advance.

    Read the article

  • wpf and win32 overlapping issue

    - by priya-hatipkar
    I have a wpf Window, which has wpf control and windows forms control hosted in WindowsFormsHost. The expected behavior is that the WPF control should be rendered on top of WindowsFormsHost. Unfortunately, this is a limitation in the interop story, WindowsFormsHost elements are always drawn on top, and don't get affected by z-order. http://msdn.microsoft.com/en-us/library/ms742522.aspx Is there any workaround to solve this problem? Regards, Priya

    Read the article

  • Keyboard Input & the Win32 message loop

    - by Tom J Nowell
    How do I handle key presses and key up events in the windows message loop? I need to be able to call two functions OnKeyUp(char c); and OnKeyDown(char c);. Current literature I've found from googling has lead me to confusion over WM_CHAR or WM_KEYUP and WM_KEYDOWN, and is normally targeted at PDA or Managed code, whereas I'm using C++.

    Read the article

  • Add newline to a text field (Win32)

    - by user146780
    I'm making a Notepad clone. Right now my text loads fine but where their are newline characters, they do not make newlines in the text field. I load it like this: void LoadText(HWND ctrl,HWND parent) { int leng; char buf[330000]; char FileBuffer[500]; memset(FileBuffer,0,500); FileBuffer[0] = '*'; FileBuffer[1] = '.'; FileBuffer[2] = 't'; FileBuffer[3] = 'x'; FileBuffer[4] = 't'; OPENFILENAMEA ofn; memset(&ofn, 0, sizeof(OPENFILENAMEA)); ofn.lStructSize = sizeof(OPENFILENAMEA); ofn.hwndOwner = parent; ofn.lpstrFile = FileBuffer; ofn.nMaxFile = 500; ofn.lpstrFilter = "Filetype (*.txt)\0\0"; ofn.lpstrDefExt = "txt"; ofn.Flags = OFN_EXPLORER; if(!GetOpenFileNameA(&ofn)) { return; } ifstream *file; file = new ifstream(FileBuffer,ios::in); int lenn; lenn = 0; while (!file->eof()) { buf[lenn] = file->get(); lenn += 1; } buf[lenn - 1] = 0; file->read(buf,lenn); SetWindowTextA(ctrl,buf); file->close(); } How can I make it do the new line characters? Thanks

    Read the article

  • Win32 window capture with BitBlt not displaying border

    - by user292533
    I have written some c++ code to capture a window to a .bmp file. BITMAPFILEHEADER get_bitmap_file_header(int width, int height) { BITMAPFILEHEADER hdr; memset(&hdr, 0, sizeof(BITMAPFILEHEADER)); hdr.bfType = ((WORD) ('M' << 8) | 'B'); // is always "BM" hdr.bfSize = 0;//sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + (width * height * sizeof(int)); hdr.bfReserved1 = 0; hdr.bfReserved2 = 0; hdr.bfOffBits = (DWORD)(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)); return hdr; } BITMAPINFO get_bitmap_info(int width, int height) { BITMAPINFO bmi; memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER)); //initialize bitmap header bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biWidth = width; bmi.bmiHeader.biHeight = height; bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biBitCount = 4 * 8; bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biSizeImage = width * height * 4; return bmi; } void get_bitmap_from_window(HWND hWnd, int * imageBuff) { HDC hDC = GetWindowDC(hWnd); SIZE size = get_window_size(hWnd); HDC hMemDC = CreateCompatibleDC(hDC); RECT r; HBITMAP hBitmap = CreateCompatibleBitmap(hDC, size.cx, size.cy); HBITMAP hOld = (HBITMAP)SelectObject(hMemDC, hBitmap); BitBlt(hMemDC, 0, 0, size.cx, size.cy, hDC, 0, 0, SRCCOPY); //PrintWindow(hWnd, hMemDC, 0); BITMAPINFO bmi = get_bitmap_info(size.cx, size.cy); GetDIBits(hMemDC, hBitmap, 0, size.cy, imageBuff, &bmi, DIB_RGB_COLORS); SelectObject(hMemDC, hOld); DeleteDC(hMemDC); ReleaseDC(NULL, hDC); } void save_image(HWND hWnd, char * name) { int * buff; RECT r; SIZE size; GetWindowRect(hWnd, &r); size.cx = r.right-r.left; size.cy = r.bottom-r.top; buff = (int*)malloc(size.cx * size.cy * sizeof(int)); get_bitmap_from_window(hWnd, buff); BITMAPINFO bmi = get_bitmap_info(size.cx, size.cy); BITMAPFILEHEADER hdr = get_bitmap_file_header(size.cx, size.cy); FILE * fout = fopen(name, "w"); fwrite(&hdr, 1, sizeof(BITMAPFILEHEADER), fout); fwrite(&bmi.bmiHeader, 1, sizeof(BITMAPINFOHEADER), fout); fwrite(buff, 1, size.cx * size.cy * sizeof(int), fout); fflush(fout); fclose(fout); free(buff); } It works find under XP, but under Vista the border of the window is transparent. Using PrintWindow solves the problem, but is unacceptable for performance reasons. Is there a performant code change, or a setting that can be changed to make the border non-transparent?

    Read the article

  • Win32 call order

    - by DD
    Hi all, I have two windows that I send scripted input to. The procedure goes as this BringWindowToTop( window1 ); i = Build input structures( window1 ); SendInput(i); BringWindowToTop( window2 ); i = Build input structures( window2 ); SendInput(i); I was having trouble with inputs not being sent and the correct time. I put delays after each call and saw that input from the first SendInput() was processed after window2 is brought to top. Same thing at the end of the loop as well. Are SendInput calls buffered? If so, how can I make sure of a serial execution of this code? Thanks

    Read the article

  • Are the *A Win32 API calls still relevant?

    - by Thanatos
    I still see advice about using the LPTSTR/TCHAR types, etc., instead of LPWSTR/WCHAR. I believe the Unicode stuff was well introduced at Win2k, and I frankly don't write code for Windows 98 anymore. (Excepting special cases, of course.) Given that I don't care about Windows 98 (or, even less, ME) as they're decade old OS, is there any reason to use the compatibility TCHAR, etc. types? Why still advise people to use TCHAR - what benefit does it add over using WCHAR directly?

    Read the article

  • C++: Implementing Named Pipes using the Win32 API

    - by Mike Pateras
    I'm trying to implement named pipes in C++, but either my reader isn't reading anything, or my writer isn't writing anything (or both). Here's my reader: int main() { HANDLE pipe = CreateFile(GetPipeName(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); char data[1024]; DWORD numRead = 1; while (numRead >= 0) { ReadFile(pipe, data, 1024, &numRead, NULL); if (numRead > 0) cout << data; } return 0; } LPCWSTR GetPipeName() { return L"\\\\.\\pipe\\LogPipe"; } And here's my writer: int main() { HANDLE pipe = CreateFile(GetPipeName(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); string message = "Hi"; WriteFile(pipe, message.c_str(), message.length() + 1, NULL, NULL); return 0; } LPCWSTR GetPipeName() { return L"\\\\.\\pipe\\LogPipe"; } Does that look right? numRead in the reader is always 0, for some reason, and it reads nothing but 1024 -54's (some weird I character). Solution: Reader (Server): while (true) { HANDLE pipe = CreateNamedPipe(GetPipeName(), PIPE_ACCESS_INBOUND | PIPE_ACCESS_OUTBOUND , PIPE_WAIT, 1, 1024, 1024, 120 * 1000, NULL); if (pipe == INVALID_HANDLE_VALUE) { cout << "Error: " << GetLastError(); } char data[1024]; DWORD numRead; ConnectNamedPipe(pipe, NULL); ReadFile(pipe, data, 1024, &numRead, NULL); if (numRead > 0) cout << data << endl; CloseHandle(pipe); } Writer (client): HANDLE pipe = CreateFile(GetPipeName(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (pipe == INVALID_HANDLE_VALUE) { cout << "Error: " << GetLastError(); } string message = "Hi"; cout << message.length(); DWORD numWritten; WriteFile(pipe, message.c_str(), message.length(), &numWritten, NULL); return 0; The server blocks until it gets a connected client, reads what the client writes, and then sets itself up for a new connection, ad infinitum. Thanks for the help, all!

    Read the article

  • Tough question on WPF, Win32, MFC

    - by Mack
    Let's suppose you're an IT student with a basic knowledge of C++ and C#. Let's suppose that you want to design apps that: need to deliver some performance like archivers, cryptographic algorithms, codecs make use of some system calls have a gui and you want to learn an Api that will enable you to write apps like those described earlier and: is mainstream is future proof entitles you to find a decent job is easy enough - I mean easy like VCL, not easy like winapi So, making these assumptions, what Api will you choose? MFC, WPF, other? I really like VCL and QT, but they're not mainstream and I think few employers will want you to write apps in QT or Visual C++ Builder... Thanks for answers.

    Read the article

  • Win32 DLL importing issues (DllMain)

    - by brady
    I have a native DLL that is a plug-in to a different application (one that I have essentially zero control of). Everything works just great until I link with an additional .lib file (links my DLL to another DLL named ABQSMABasCoreUtils.dll). This file contains some additional API from the parent application that I would like to utilize. I haven't even written any code to use any of the functions exported but just linking in this new DLL is causing problems. Specifically I get the following error when I attempt to run the program: The application failed to initialize properly (0xc0000025). Clock on OK to terminate the application. I believe I have read somewhere that this is typically due to a DllMain function returning FALSE. Also, the following message is written to the standard output: ERROR: Memory allocation attempted before component initialization I am almost 100% sure this error message is coming from the application and is not some type of Windows error. Looking into this a little more (aka flailing around and flipping every switch I know of) I linked with /MAP turned on and found this in the resulting .map file: 0001:000af220 ??3@YAXPEAX@Z 00000001800b0220 f ABQSMABasCoreUtils_import:ABQSMABasCoreUtils.dll 0001:000af226 ??2@YAPEAX_K@Z 00000001800b0226 f ABQSMABasCoreUtils_import:ABQSMABasCoreUtils.dll 0001:000af22c ??_U@YAPEAX_K@Z 00000001800b022c f ABQSMABasCoreUtils_import:ABQSMABasCoreUtils.dll 0001:000af232 ??_V@YAXPEAX@Z 00000001800b0232 f ABQSMABasCoreUtils_import:ABQSMABasCoreUtils.dll If I undecorate those names using "undname" they give the following (same order): void __cdecl operator delete(void * __ptr64) void * __ptr64 __cdecl operator new(unsigned __int64) void * __ptr64 __cdecl operator new[](unsigned __int64) void __cdecl operator delete[](void * __ptr64) I am not sure I understand how anything from ABQSMABasCoreUtils.dll can exist within this .map file or why my DLL is even attempting to load ABQSMABasCoreUtils.dll if I don't have any code that references this DLL. Can anyone help me put this information together and find out why this isn't working? For what it's worth I have confirmed via "dumpbin" that the parent application imports the same DLL (ABQSMABasCoreUtils.dll), so it is being loaded no matter what. I have also tried delay loading this DLL in my DLL but that did not change the results.

    Read the article

  • Win32: How to crash?

    - by Ian Boyd
    i'm trying to figure out where Windows Error Reports are saved; i hit Send on some earlier today, but i forgot that i want to "view the details" so i can examine the memory minidumps. But i cannot find where they are stored (and google doesn't know). So i want to write a dummy application that will crash, show the WER dialog, let me click "view the details" so i can get to the folder where the dumps are saved. How can i crash on Windows?

    Read the article

  • Is key 'chord' functionality provided by Win32/.net?

    - by John
    Several MS apps support the concept of chords, like "CTRL+X,Y" which means "holding down CTRL, press X, then Y". Is this a bespoke thing they (and other companies) implement, or is it built into any APIs? It would be nice to be able to set up event handlers or accelerators based on chords rather than write code to do it.

    Read the article

  • Win32: edit control selection in dialog-based app

    - by Lars Kanto
    I have a dialog-based app with an edit-control in it. When I minimize / restore the app, everything's ok. But when I hide all the windows with holding down that Windows-logo-key and pressing "D" and then I restore the app, the edit-control selects everything inside it. How to make it not to select the text on restore?

    Read the article

  • how can a Win32 App plugin load its DLL in its own directory

    - by Jean-Denis Muys
    My code is a plugin for a specific Application, written in C++ using Visual Studio 8. It uses two DLL from an external provider. Unfortunately, my plugin fails to start because the DLLs are not found (I put them in the same directory as the plugin itself). When I manually move or copy the DLLs to the host application directory, then the plugin loads fine. This moving was deemed unacceptably cumbersome for the end user, and I am looking for a way for my plugin to load its DLLs transparently. What can I do? Relevant details: the host Application plugins are located in a directory mandated by the host application. That directory is not in the DLL search path and I don't control it. The plugin is itself packaged as a subdirectory of the plugin directory, holding the plugin code itself, but also any resource associated with the plugin (eg images, configuration files…). I control what's inside that subdirectory, called a "bundle", but not where it's located. the common plugin installation idiom for that App is for the end user to copy the plugin bundle to the plugin directory. This plugin is a port from the Macintosh version of the plugin. On the Mac there is no issue because each binary contains its own dynamic library search path, which I set as I needed to for my plugin binary. To set that on the Mac simply involves a project setting in the Xcode IDE. This is why I would hope for something similar in Visual Studio, but I could not find anything relevant. Moreover, Visual Studio's help was anything but, and neither was Google. A possible workaround would be for my code to explicitly tell Windows where to find the DLL, but I don't know how, and in any case, since my code is not even started, it hasn't got the opportunity to do so. As a Mac developer, I realize that I may be asking for something very elementary. If such is the case, I apologize, but I have run out of hair to pull out.

    Read the article

  • DialogBox in Win32 - Prevent multiple instance

    - by UK
    Hello all, I have a program which creates DialogBox window when user clicks the menu item from tray icon, case ID_OPTIONS: DialogBox ( GetModuleHandle ( NULL ), MAKEINTRESOURCE ( IDD_SETUP_DIALOG ), hWnd, reinterpret_cast<DLGPROC>(SetupDlgProc) ); return 0; But the problem here is everytime when users clicks item from tray , a new instance of the dialogbox appears. Is there anyway to prevent this multiple instance ? BTW, my SetupDlgProc looks like this, BOOL CALLBACK SetupDlgProc ( HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam ) { switch ( Message ) { case WM_INITDIALOG: ... } } Thanks for your help.

    Read the article

  • win32 sdk: how to make the caption/border of a child window transparent

    - by Eric
    I'm creating a child window within the main window. I assigned these styles to the child window: WS_CHILDWINDOW | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | WS_SIZEBOX | WS_CAPTION The child window I get has a caption and a resizable border. However there's no close button in the caption, and the caption/border of the child window is not transparent (I'm using the aero theme in windows 7). Here is the screen snap: How to add close button to the caption? How can I make the caption/border transparent?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >