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
C

c121hains

@c121hains
About
Posts
31
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Time consuming Stored Proc + Progress bar
    C c121hains

    I have this giant stored procedure executing many small queries. In between these queries, i want to be able to return a record or just some number to the record set so that i can update the value for a progress bar in my program. I have the asyncFetch part set when i do an open: Set mRS = New ADODB.Recordset mRS.CursorType = adOpenStatic mRS.CursorLocation = adUseClient mRS.LockType = adLockBatchOptimistic mRS.Properties("Initial Fetch Size") = 1 mRS.Open sTmp, gdb, adOpenStatic, adLockBatchOptimistic, adCmdText + adAsyncExecute + adAsyncFetch I also set up an event in VB to catch the record set's fetch: Private Sub mRS_FetchProgress(ByVal Progress As Long, ByVal MaxProgress As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset) Debug.Print "Fetch: " & Progress & _ " Max: " & MaxProgress End Sub .. but it never gets there. -- modified at 20:33 Wednesday 21st December, 2005

    Database database debugging announcement

  • Keyboard Hook in MFC -- Minor Syntax
    C c121hains

    Ohhh i see. There's a setting in visual studio (statically link objects or something) so that i can compile my EXE and DLL into one EXE right? How do i do this?

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

  • Keyboard Hook in MFC -- Minor Syntax
    C c121hains

    Every example of using Keyboard hooks with MFC seems to be in a DLL. Is there any reason for this? I'm trying to do it in a separate class so my program will be all together. How do you do this? I've pasted what I have so far but the error i get is: error C2664: 'SetWindowsHookExA' : cannot convert parameter 2 from 'long (int,unsigned int,long)' to 'long (__stdcall *)(int,unsigned int,long)' None of the functions with this name in scope match the target type //Keyboard hook callback LRESULT CALLBACK CKeyboardHook::KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) { try { KBDLLHOOKSTRUCT *pkbhs = (KBDLLHOOKSTRUCT *) lParam; if (nCode >= 0) { if (wParam == WM_KEYDOWN) { BOOL bControlKeyDown = FALSE; // Check to see if the CTRL key is pressed bControlKeyDown = GetAsyncKeyState (VK_CONTROL) >> ((sizeof(SHORT) * 8) - 1); if ((pkbhs->vkCode == VK_F) && bControlKeyDown) { SendMessage(hWnd,UWM_SETVISIBLE, 0, 0); ShowWindow(hWnd, SW_RESTORE); } } } } catch(...) { } return CallNextHookEx( hkb, nCode, wParam, lParam ); } BOOL CKeyboardHook::InstallHook() { HINSTANCE ppI = AfxGetInstanceHandle(); hkb=SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardProc,ppI,0); return TRUE; } ---- and in the header: class CKeyboardHook { public: CKeyboardHook(); LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam); BOOL InstallHook(); ... :confused:

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

  • Delete [] charPtr... Pls help
    C c121hains

    This works: char* CFindInWindowDlg::GetTextLinesBuffer() { CString allText = ""; for (int a = 0; a < numLines; a++) { allText += lines[a].GetBuffer(0); lines[a].ReleaseBuffer(); } return allText.GetBuffer(0); } Any idea why I need to use GetBuffer instead of string1 += string2?

    C / C++ / MFC help data-structures performance tutorial question

  • Delete [] charPtr... Pls help
    C c121hains

    This works: char* CFindInWindowDlg::GetTextLinesBuffer() { CString allText = ""; for (int a = 0; a < numLines; a++) { allText += lines[a].GetBuffer(0); lines[a].ReleaseBuffer(); } return allText.GetBuffer(0); } Any idea why I need to use GetBuffer instead of string1 += string2?

    C / C++ / MFC help data-structures performance tutorial question

  • Delete [] charPtr... Pls help
    C c121hains

    This works: char* CFindInWindowDlg::GetTextLinesBuffer() { CString allText = ""; for (int a = 0; a < numLines; a++) { allText += lines[a].GetBuffer(0); lines[a].ReleaseBuffer(); } return allText.GetBuffer(0); } Any idea why I need to use GetBuffer instead of string1 += string2?

    C / C++ / MFC help data-structures performance tutorial question

  • Delete [] charPtr... Pls help
    C c121hains

    This works: char* CFindInWindowDlg::GetTextLinesBuffer() { CString allText = ""; for (int a = 0; a < numLines; a++) { allText += lines[a].GetBuffer(0); lines[a].ReleaseBuffer(); } return allText.GetBuffer(0); } Any idea why I need to use GetBuffer instead of string1 += string2?

    C / C++ / MFC help data-structures performance tutorial question

  • Delete [] charPtr... Pls help
    C c121hains

    In the debugger.. There is no change to the original string: originalString = "the original string \r\n"; originalString += "a new string \r\n"; ------ originalString still equals "the original string \r\n"; Do you get a different result?

    C / C++ / MFC help data-structures performance tutorial question

  • Delete [] charPtr... Pls help
    C c121hains

    I tried that but it didn't work. Here is an example of what happens: string1 = "this is a string \r\n"; string2 = "this is an appended string \r\n"; string1 += string2; string1 still equals "this is a string \r\n" and doesn't append string2!! I need those '\r' and '\n' characters. By putting them all into a char string, it fixes this problem.

    C / C++ / MFC help data-structures performance tutorial question

  • Delete [] charPtr... Pls help
    C c121hains

    Actually the code works fine. Everything is allocated the way i want it to. The only problem is deleting. I can't seem to do that.

    C / C++ / MFC help data-structures performance tutorial question

  • Delete [] charPtr... Pls help
    C c121hains

    When I attach the CStrings together (newString = string[0] + string[1] + string[2] ..), the result does not correctly append the strings. My strings contain '\n' and '\r' characters and it seems that when I use the newString += string, only the first result is copied. Here is an example: string1 = "this is a string \r\n"; string2 = "this is an appended string \r\n"; string1 += string2; string1 still equals "this is a string \r\n" and doesn't append string2!! I need those '\r' and '\n' characters. By putting them all into a char string, it fixes this problem.

    C / C++ / MFC help data-structures performance tutorial question

  • Delete [] charPtr... Pls help
    C c121hains

    All i want to do is get all of the text together from an array of CString objects and put it into a single char* pointing to a string. I'm doing memory allocation and I can't find away to delete the original temp data. It works, but..."I'm stomping on other memory!" :wtf: This should be the easiest thing ever. But i'm worried about a memory leak here. Whenever I try to delete allText before creating a NEW allText allocation, it dies. Any ideas how to fix these memory leaks? char* CFindInWindowDlg::GetTextLinesBuffer() { char* allText = NULL; char* source = NULL; int sizeAllText = 0; if (numLines > 0) { // **** 'lines' is my array of CString objects!!! int sizeAllText = strlen(lines[0].GetBuffer(0)); source = new char[sizeAllText]; strcpy(source, lines[0].GetBuffer(0)); for (int a = 1; a < numLines; a++) { // **** 'lines' is my array of CString objects!!! sizeAllText = MergeLines(&allText, sizeAllText, &source, lines[a].GetBuffer(0)); source = allText; } } return allText; } int CFindInWindowDlg::MergeLines(char** allText, int sizeSource, char** source, char* aLine) { int newSize; if ((sizeSource == 0) && (*source == NULL)) { *allText = new char[strlen(aLine)]; newSize = strlen(aLine); strcpy(*allText, aLine); return newSize; } newSize = sizeSource + strlen(aLine); *allText = new char[newSize]; strcpy(*allText, *source); strcat(*allText, aLine); return newSize; }

    C / C++ / MFC help data-structures performance tutorial question

  • Selecting Text - Pls Help!!
    C c121hains

    EXCELLENT! It works... it's alive!!!!!!!!! hehehe Thanks a million!:cool:

    C / C++ / MFC help announcement

  • Selecting Text - Pls Help!!
    C c121hains

    :confused: This should be easy. All i want to do is have some text highlighted in a control in another window. The control doesn't respond to any EM_* messages so i'm simulating the selection of text by sending a series of VK_RIGHT and VK_SHIFT key presses. The problem is that it the 'right arrow' key gets pressed but the control doesn't have the effect of the 'shift' key. I know it gets pressed because once i move around in the control, the shift key is still down (when i uncomment the shift release key press - see last line of below method)!! I have to do it this way as i have no other choice. Here's the code: window->BringWindowToTop(); //THIS PART WORKS //Same effect as pressing the right arrow key 10 times for (int a = 0; a < 10; a++){ wnd->SendMessage(WM_KEYDOWN, VK_RIGHT, 0); wnd->SendMessage(WM_KEYUP, VK_RIGHT, 0); } //This part should select the next 5 characters of text. //Simulates holding down shift and pressing 'Right Arrow' key 5 times INPUT input[2]; for (int b = 0; b < 5; b++){ input[0] = GetKeyboardInput(VK_LSHIFT, 0); input[1] = GetKeyboardInput(VK_RIGHT, 0); //Press down shift and right arrow key SendInput(2, input, sizeof(INPUT)); input[1] = GetKeyboardInput(VK_RIGHT, 2); //Release right arrow key SendInput(2, input, sizeof(INPUT)); } //Release the shift key input[0] = GetKeyboardInput(VK_LSHIFT, 2); SendInput(2, input, sizeof(INPUT)); INPUT CFindInWindowDlg::GetKeyboardInput(short key, int downUp) { INPUT input; input.type = 0x01; //INPUT_KEYBOARD input.ki.dwExtraInfo = 0; input.ki.time = 0; input.ki.wScan = 0; input.ki.wVk = key; input.ki.dwFlags = downUp; return input; } Any help would be greatly appreciated. My head is going to explode! :wtf:

    C / C++ / MFC help announcement

  • EM_SETSEL -- Edit Control Messages
    C c121hains

    Anyone have any ideas? :confused:

    C / C++ / MFC database question lounge

  • EM_SETSEL -- Edit Control Messages
    C c121hains

    I'm creating a plugin for Enterprise Manager's Stored Procedure dialog box to enable it to have "Find Text" capability. If you've seen this text box that contains the SQL Stored Procedure text, you'll know that it highlights certain key input text. So it's handling is slightly different than your average EditBox or RichTextBox control. I have found that this "DimensionEdit" object (the name of that text box control class), does NOT respond to any EM_* windows messages (eg. EM_SETSEL). It does, however, respond to general WM_GETTEXT and WM_SETTEXT messages. The funny thing is, it sort of acts like a RichTextBox control. When i'm in the Enterprise Manager program, I can select text in it and it will be highlighted correctly. BUT i want to be able to highlight text from an external application by passing windows messages. This "DimensionEdit" object may have its own custom message handling. I've searched everywhere for what this object is and can't find any info on it. A clumsy way to do this would be to set the font of the 'found' text. But that is just a workaround. So... if you can select the text manually in the program, then why can't i send a message to the control (via external app with SendMessage) to do the same?? Any ideas are GREATLY appreciated!:sigh:

    C / C++ / MFC database question lounge

  • Access Controls in Other Apps
    C c121hains

    I didn't need to. I know the class name in the dialog that i need. The problem was getting the handle to the dialog itself. I had to enumerate through the all handles at the sub desktop level.

    C / C++ / MFC javascript question

  • Access Controls in Other Apps
    C c121hains

    I managed to finally get it working. I had to first grab the handle to the desktop and use GetNextWindow through about 200+ handles to get the one matching the partial window text that i was looking for. The dialog's window text that i wanted contained static and dynamic text. That was why i couldn't just find the window with just he window's text. Thanks for the help! :)

    C / C++ / MFC javascript question

  • Access Controls in Other Apps
    C c121hains

    So.. are you saying that this would work: HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "CDialog", NULL); ..but in Spy++, the name of the class is #32770. If it's a dialog class, how come the order of window controls is: - DimensionEdit - #32770 - #32770 - MMCEnterprise Manager Main Window When i'm looking at it, it is - Some edit box within a tab order control within a dialog box window all within the main Enterprise Manager window. :(:(:(

    C / C++ / MFC javascript question

  • Access Controls in Other Apps
    C c121hains

    The class that i want (DimensionEdit) is within a class called "#32770" and that itself is within a "#32770" which lies within the base "MMCMainFrame" window. Everytime I run HWND hWnd = FindWindowEx(enterprise->m_hWnd, NULL, "#32770", NULL); It fails to bring up the correct handle! Entering in the description of the window doesn't work either. Please help!

    C / C++ / MFC javascript 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