Topics
-
SendMessage for keystroke is not working
by Guest poirepoisson- 0 replies
- 810 views
Hi all could you please tell me why this code does not work? It should simulate the pression of TAB and then arrow DOWN, but nothing happens. I´m sure I have the right handle to the window, because I can click with the mouse on some of its buttons. SetForegroundWindow(hwndWindow); SetActiveWindow(hwndWindow); SetFocus(hwndWindow); SendMessage(hwndWindow, WM_SETFOCUS, VK_TAB, 0); //tried also without SendMessage(hwndWindow, WM_SETFOCUS, VK_TAB, 0); //these 2 messages Sleep(500); SendMessage(hwndWindow, WM_KEYDOWN, VK_TAB, 0); SendMessage(hwndWindow, WM_KEYUP, VK_TAB, 0); Sleep(1000); SendMessage(hwndWindow, WM_KEYDOWN, VK_DOW…
-
multiple keyboard events on single key
by Guest PaltryProgrammer- 0 replies
- 414 views
Running the code below and pressing a key once results in two separate keyboard events with the output being 1 1 Kindly advise Thank You Cheerios #include <iostream> #include <cassert> #include <windows.h> void keyboard(HANDLE hstd_input) { INPUT_RECORD input_record; DWORD nevents = 0; BOOL ok = ReadConsoleInput(hstd_input, &input_record, 1, &nevents); assert(ok); std::wcout << nevents << std::endl; } int main() { HANDLE hstd_input = GetStdHandle(STD_INPUT_HANDLE); keyboard(hstd_input); keyboard(hstd_input); } Continue reading...
-
.lib is not a valid Win32 application - Visual Studio 2017
by Guest Brown12345- 0 replies
- 497 views
My program is not running due to this error which pops up. I tried building and cleaning my solution but it still does work. I am working in visual studio c++ and have created a static link library which I want to link to my <g class="gr_ gr_46 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="46" id="46">cpp</g> file. I have a windows 10 X64 bit computer Below is the error Unable to start program c:\users\source\repos\NewProject\NewProject.lib c:\users\source\repos\NewProject\NewProject.lib is not a valid Win32 application Please Help me it would be great Thank you in advance! Continue reading...
-
Exception for Custom Memset function with Large array to set value.
by Guest Harsha_MR- 0 replies
- 428 views
I have written a custom Memset function instead of using the one provided by compiler itself. I'm don't see any issue when initializing an array with smaller length but while initializing for larger array length (say 5000000), I do get an exception for access violation. "Exception thrown: write access violation. Ddest_p was 0x4DA4E112." I have 2 design made for this custom memset but in both the case I do get the same exception at the same place when initializing for larger array. If I use compiler provided API, I don't see any exception. So, not sure how this access violation exception is showing up only with these design. Array gets initialized to some ext…
-
Visual Studio MFC dialog application. CListCtrl sort function
by Guest gsegria- 0 replies
- 424 views
I created a dialog application in Visual Studio MFC. I use CListCtrl to list some data. Any way to sort List1 or List2 when i press List1 or List2? For example: List1(Name) List2(Birthday) Bill 1995/1/5 Abby 1990/5/3 Tony 1999/3/30 Continue reading...
-
Visual Studio MFC dialog application. CListCtrl function
by Guest gsegria- 0 replies
- 495 views
I created a dialog application in Visual Studio MFC. I use CListCtrl to list some date. (Item and Content) I don't change any code in CListCtrl's cpp and h files but CListCtrl color was from gray to white. 1) No change any code , I don't understand why CListCtrl color from gray to white? 2) Any way to change CListCtrl color from white to gary? void XXX::Init() { LONG lStyle; lStyle = GetWindowLong(this->m_lst1.m_hWnd, GWL_STYLE); lStyle |= LVS_REPORT; SetWindowLong(this->m_lst1.m_hWnd, GWL_STYLE, lStyle); DWORD dwStyle = this->m_lst1.GetExtendedStyle(); dwStyle |= LVS_EX_FULLROWSELECT; dwStyle |= LVS_EX_GRIDLINES; this->m_lst1.Se…
-
- 0 replies
- 486 views
Visual Studio PRO 2005 I can not find the C/C++ option in the Property Pages window under Configuration Properties. My list goes General, Debugging, Linker, Manifest Tool, etc... I am trying to set up some compiler options as listed in a tutorial I am doing for SDL. I have tried re-installing, as well as different install configs. I tried resetting the environment to the General config and the Visual C++ 6 config. I have looked over MSDN and the web in general and I am stumped. I have also tried it on 2 different computers just to see if it was an external issue. Continue reading...
-
How to get Unicode output from cl.exe?
by Guest Yuri Plyakhin- 0 replies
- 438 views
Hello, I have a code that runs "cl.exe" by CreateProcess. Then I parse the output from "cl.exe". All works fine with English characters. But if output contains non-English characters, I get "???????" instead of non-English characters. As I know, "cl.exe" can create two named pipes and write Unicode output to them, instead of using stderr and stdout. Also, I've read about an environment variable "VS_UNICODE_OUTPUT". As I've understand that variable causes "cl.exe" to create these two named pipes. The questions are: How can I run "cl.exe" in such mode (to get Unicode output)? What names should I use for pipes? What value should I set to "VS_UNICODE_OUTPUT", and…
-
- 0 replies
- 418 views
I am working on software that is supposed to check a wireless network connection to a DSLR camera. When I call WlanGetAvailableNetworkList(), the entry for my local wifi network looks fine. (dwFlags = 3. WLAN_AVAILABLE_NETWORK_CONNECTED and WLAN_AVAILABLE_NETWORK_HAS_PROFILE) But the entry for the camera has dwFlags of 258. In wlanapi.h, I found: // available network flags #define WLAN_AVAILABLE_NETWORK_CONNECTED 0x00000001 // This network is currently connected #define WLAN_AVAILABLE_NETWORK_HAS_PROFILE 0x00000002 // There is a profile for this network #define WLAN_AVAILABLE_NETWORK_CONSOLE_USER_PROFILE 0x0000000…
-
Visual Studio MFC dialog application , Press button to clicked
by Guest gsegria- 0 replies
- 429 views
I created a dialog application in Visual Studio MFC. I create BN_CLICKED function to enable IDC_CHECK1. I create DOUBLECLICKED function to other functoin. When i call DOUBLECLICKED function will call BN_CLICKED function . Any way to call DOUBLECLICKED function and don't call BN_CLICKED function . ============================== void CMyTest1Dlg::DoStaticFunc(int iSelectIndex) { BOOL boCState; boCState = this->m_chk1[iSelectIndex].GetCheck(); this->m_chk1[iSelectIndex].SetCheck(!boCState); } void CMyTest1Dlg::OnBnClickedButton1() { // TODO: Add your control notification handler code here DoStaticFunc(0); } void CMyTest1Dlg::O…
-
- 0 replies
- 523 views
I created a dialog application in Visual Studio MFC. I copy some button and edittext from A.rc to B.rc in resource view. B.rc -> There are duplicate IDs in resource.h Any good way to sort out IDs in B.rc? Continue reading...
-
Simple (I hope) c++ question - cout an object of a user defined class
by Guest KeithLovell- 0 replies
- 423 views
I am not sure if this is the right forum for this question but it is the nearest that I have been able to find. This code was adapted from code supplied in the book c++ for dummies. I would like to be able to output the student id number in the cout statements in main() but cannot figure out how to make it compile (using Visual Studio) #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int nextStudentId = 1000; // first valid student id class StudentId { public: // default constructor assigns student-ids sequentially StudentId() { value = nextStudentId++; cout << "Take next student id " << value …
-
C++20 chrono is_clock addition missing
by Guest brettkoenig- 0 replies
- 398 views
I recently discovered the existence of is_clock in the chrono library, and according to cppreference it's a C++20 feature. Unfortunately I can't link it at the moment since my account is not verified yet, but it can easily be found. Is this not yet implemented? I have the latest version of Visual Studio Community 2019 and it seems to be missing. Are there any plans for this? Thanks. Continue reading...
-
Visual Studio MFC dialog application , Press ESC to exit app
by Guest gsegria- 0 replies
- 404 views
I created a dialog application in Visual Studio MFC. I run the exe file and press "ESC" , the app will be closed. Any way to don't close app when user press "ESC"? Continue reading...
-
CreateFileMapping; possible memory leak?
by Guest DonDilworth- 0 replies
- 433 views
My program uses CreateFileMapping so multiple processes can access a common data base. The program runs fine and produces the correct answers. But when all is finished, sometimes the Windows OS has crashed. Other programs won't load, and the Power | Restart button doesn't work. I have to run shutdown.exe and then cold start the PC. I UnmapViewOffile for each mapping I create, and then close the handle. Here is the code. Did I leave out anything? #pragma optimize("g", off ) // core 0 comes here to get addresses of arrays for other cores void preparederivmap( int &npas ) // create mapping of data for other cores { int size = 15001*412 + 128; …
-
Sample Client, TCP-Socket
by Guest Markus Freitag- 0 replies
- 475 views
Hi, I have to implement a client in an existing C++/MFC application and send XML telegrams. Do you have a sample code. If no response is received within 2 seconds, error message. <ROOT> <ORDER_REQ state="?" /> </ROOT> //----- <ROOT> <ORDER_RES current="030121521993100000001000" /> </ROOT> Thanks in advance. Best regards Markus. Continue reading...
-
How to handle the situation where shared data (shared memory) using raw pointers being used in two separate threads in C++?
by Guest John paul coder- 0 replies
- 421 views
Hello All, Could someone please help me, how to handle the situation where the same shared data (shared memory) using raw pointers being used in two separate threads? Below is the code snippet and the detailed explanation of the scenario: Here in the below function, we use the l_hNewProcessObj which is created. And this is the raw pointer CTestImpl* CMyImpl::createProcessObject(string f_hStrSFID, string f_nCallID, bool f_boReceiveCall) { CTestImpl * l_hNewProcessObj = NULL; ReturnCode l_eReturnCode = RETURNCODE_SUCCESS; l_hNewProcessObj = new (std::nothrow) CTestImpl(f_nCallID, f_hStrSFID, f_boReceiveCall, …
-
GetClassName buffer length
by Guest PaloMisik- 0 replies
- 427 views
How can I find out length of string of WindowClassName ? I need it because I want to use GetClassName function and it need buffer with specified length. Continue reading...
-
stat() fails if path has a trailing backslash
by Guest nsp2092- 0 replies
- 407 views
Hi! I have a directory "C:\stageroot". If I pass filename to stat() as follows, stat() returns non-zero exit code. filename = "C:\\stageroot" stat(filename, &sb); However if filename has a trailing backslash, stat() fails with ENOENT. filename = "C:\\stageroot\\" stat(filename, &sb); Is this expected? I am using VS2008. Thanks! Continue reading...
-
In a DLL why should a wstring pointer not work?
by Guest ananda vardhana- 0 replies
- 437 views
Hello, MyFunc() does not build and MyFunc1() builds and works. I get the following error for MyFunc(): error LNK2019: unresolved external symbol _invalid_parameter referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z) error LNK2019: unresolved external symbol _CrtDbgReport referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEA…
-
Who's Online 0 Members, 0 Anonymous, 10 Guests (See full list)
- There are no registered users currently online