Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: cClickButton cPostMessage
When I close the font window the fontwnd=dllwhnd statement tries to execute and fails since the window has gone away.
Although the method used in cClickButton is the recommended procedure, we have found that indeed it hangs in certain places.
With SendMessage, a message is sent and the program waits for a response for each message.
With Postmessage it does not wait for a response, so if some program is not responding....it does not stop.
The two situations where I have noticed this behaviour so far are the Add button on the 'Network' configuration dialog that brings up the 'Select Network Component type' dialog. and the chdir button on ws_ftp32. Both of these examples running on windows 95.
I would like to see cClickbutton returning normally after clicking the buttons. I might be able to use SendKeys to get around this temporarily, but I would not be a workable long-term solution.
A piece of what I was working on is below. I get stalled out at the "XXXX".
************* AddExtender("wwctl34I.dll") WinActivate("Attach Tables") ;an Access window parentwnd=DLLHwnd("Attach Tables") chldlistbox=cWndByClass(parentwnd,"ListBox") ;list of sql tables on oracle server listresponse=cGetLBText(chldlistbox) tabletoattach=ItemLocate("ACS.CENSUS", listresponse, @TAB) ;look for particular table (usually a var) cSetLBItem(chldlistbox,tabletoattach) chldatchbtn=cWndByName(parentwnd,"Attach") clickattach=cClickButton(chldatchbtn) ;XXXX click on Attach button messagewnd=DLLHwnd("Microsoft Access") ;try to get "Attachment worked" message box handle msgwndmsg=cWndBySeq(messagewnd,4) ;get actual message handle msgwndmsg=cWndInfo(msgwndmsg,0) If msgwndmsg=="Successfully attached 'ACS_CENSUS_G_ID'." ;kill message box cancelmessage=cWndByName(messagewnd,"OK") cClickButton(cancelmessage) Else Pause("Attach Error","An error occurred while attaching!%@crlf%Continue Attaching other tables?") EndIf *************
AddExtender("wwctl34I.dll") ;Open the Network Control Panel Run("rundll32.exe", "shell32.dll,Control_RunDLL netcpl.cpl") ;Get a handle to the Network Control Panel stitle="Network" hNetworkCP=DllHwnd(stitle) ;Get a handle to the Configuration Tab hwConfiguration= cWndByName(hNetworkCP,"Configuration") ;Click the Add button hbAdd=cWndByName(hwConfiguration, "Add...") cPostMessage(hbAdd,245,0,0) ; 245 == BM_CLICKED message("hello", "there")The problem is that if you try to do *anything* to the dialog (Select Network Component Type), I keep getting the window not found error.
I've used every function I can think of and I CANNOT get a handle to this window.
When I use the next two lines to choose the window (Select Network Component Type) that comes up
>sTitle="Select" >hAddWindow=DLLHwnd(sTitle)I don't think the above two lines work because the Message always pops up 0 for the handle when I try to display the handle in a message statement:
>Message(hAddWindow,"Test")Finally, this line then *ALWAYS* gives an error saying "parent window does not exist" which makes me think that DLLHwnd is not returning a valid handle on the statement:
>hlbMCMN=cWndByID(hAddWindow, 504)Help! I need a handle.
hAddWindow=DLLHwnd(sTitle)
Try...
TimeDelay(3) hAddWindow=DLLHwnd(sTitle)OR
TimeDelay(3) xxx=WinGetActive() hAddWindow=DLLHwnd(xxx)A note regarding tabbed dialogs:
You MUST select the tab before going after the control in question. The trick is that Windows does not even bring the controls into existence until the tab is clicked.
So use the ummm cSetTabItem function to select the tab, do a small TimeDelay, then go after the control.
If WinExistChild("Microsoft Outlook 97 Setup", "Product ID:") ParentWnd=DllHwnd("Microsoft Outlook 97 Setup") ChildWnd=CwndbyID(ParentWnd,0) OKBUtton=CwndbyID(Childwnd,1) TimeDelay(3) cClickButton(OKButton) ;cPostMessage(OKButton,245,0,0) Endif
Article ID: W12508
Filename: How to Click a Button without Hanging.txt
File Created: 2001:06:14:16:35:34
Last Updated: 2001:06:14:16:35:34