|
weird...
that works with notepad, but not with the chat program i'm writing this for.
besides, i don't want to have to hold the mouse cursor over the input box whenever I want to send something.
surely there's an API call to get the active child?
=====
Phlip
Always proofread carefully to see if you any words out
|
|
|
|
|
Receiving a message is one thing, and displaying contents in an editbox is another. Not every thing is displayable, probably your receiver-window is not able to display that kind of characters----notepad can maybe, but that doesn't mean your editbox can too.
But of course you need to first make sure that your receiver-window really has received the aforementioned message(WM_CHAR), so override its PreTranslateMessage and see...
|
|
|
|
|
it's able to display it when i type it in (via alt+numpad)
i'm sending the message to an IRC client - i don't exactly want to crack it and override its PreTranslateMessate.
I'm giving up on writing this in C. I'm porting the whole thing to VB - it's SendKeys function does wnat I want.
The only reason I didn't write it in VB to begin with is because i couldn't get EnumWindows to work properly, but i've figured it out now.
Thanks anyway for your suggestions.
=====
Phlip
Always proofread carefully to see if you any words out
|
|
|
|
|
Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, lParam As Long) As Long
Function EnumChildProc(ByVal hwnd As Long, lParam As Long) As Long
' DO SOMETHING WITH HWND HERE
End Function
Call EnumChildWindows(parentWnd, AddressOf EnumChildProc, 1)
Phlip,
I hope this VB code sample I typed will help you. It hurts to write this, but you could do the exact same thing in VC++, as a matter of fact doing it in VB is a bizzare abstraction of the real C++ API.
Saying you have to port it to visual basic doesn't make much sense to me although I'm sure you have your reasons.
|
|
|
|
|
What I'm trying to make is an automatic typer thingy for chat programs - just click a button and it types a bunch of stuff for you.
I could write the typing bit easily in VB - there's a function called "SendKeys" which does exactly that. But I didn't know of the AddressOf operator at that stage, so I though I'd have to use C++ to use EnumWindows because you have to pass a function pointer to it.
I then figured out how to use SendInput and made a function that turned a string into an array of INPUTs that would type that string (complete with things like '{' -> {SHIFT DOWN}'['{SHIFT UP}) but I ran into trouble if i wanted to include characters that weren't directly typable on the keyboard.
But now I've learned the AddressOf operator in VB so I have no problems programming it there.
If I know how to do it in VB, but don't in C, why bother trying to do it in C?
I would have preferred to do it in C, for obvious reasons (VB is, well, VB after all, for crissake), but the right tool for the right project and all that...
=====
Phlip
Always proofread carefully to see if you any words out
|
|
|
|
|
Hi,
I need to be able to get the window name of a MDI window when it is created. I tried adding the following code to CProjectNameDoc::OnNewDocument() :
<br />
CProjectNameDoc::OnNewDocument()<br />
{<br />
if (!CDocument::OnNewDocument()) return FALSE;<br />
<br />
CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();<br />
<br />
HWND hWnd;<br />
TCHAR szWndTitle[256];<br />
<br />
hWnd = ::GetWindow(pMainFrame->m_hWndMDIClient, GW_CHILD);<br />
<br />
::GetWindowText(hWnd,szWndTitle,<br />
sizeof(szWndTitle)/sizeof(szWndTitle[0]));<br />
<br />
AfxMessageBox(szWndTitle);<br />
}<br />
This however does not work correctly. The name displayed when I create a new window is the name of the window before.
The reason for this (as far as I can tell) is that OnNewDocument() is called before the window is created, so the name of the currently selected one is returned.
Any ideas how to fix this?
Thanks,
Mike
I also need to get a pointer to this window. I tried:
((CMainFrame *)AfxGetMainWnd())->GetActiveFrame()
But this seems to have the same time problem as before. I get a pointer to the window before the one being created ...
There are 10 people in the world
Those who understand binary and those who dont
|
|
|
|
|
BOOL CProjectNameDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument()) return FALSE;
AfxMessageBox(GetTitle( ));
return TRUE;
}
Good thing I have nothing to do all day
|
|
|
|
|
If i build a VxD using the Win98 DDK will it work in Win XP???
Kuniva
--------------------------------------------
|
|
|
|
|
AFAIK Windows XP does not use VXD drivers. So likely not.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
lol, err ok stupid question
anyways, how can I access low level stuff on windows XP then?
and ergh... this means, if i had driver code for Win98 i'll have to rewrite everything for Win XP?... that sucks..
Kuniva
--------------------------------------------
|
|
|
|
|
and err there's a WinXP DDK, whats that all about then???
and what does AFAIK mean????
Kuniva
--------------------------------------------
|
|
|
|
|
|
only shipping!
Don't try it, just do it!
|
|
|
|
|
eh, u see, i've already been there, a FEW times lol. Booo @ M$ they used to give it for download for free now u have to freckin order it. I cliked order once and it said 0$ so i thought hey this might not be so bad afterall, but then i got to checkout and turns out i would need to pay 25$ for shipping costs since i'm in Belgium.
So i ran a search for an alternative (read 'illegal') download location of the Win98 DDK. And i found one! like the third search result or something lead me to a non-MS page and it had a download link on it directly to the MS server where u could STILL download the Win98 DDK!!! I mean.. how freaky is that, they take it off and make u order a CD with the new DDK but they just leave the file there, handy..
Anyways, so i downloaded it, and when i installed it said it was for Driver development with Win98 and Win2000 (and NT4). But if its compatible with Win2000, isn't it compatible with XP too?? or is there a difference between XP and 2000 i'm missing...
Thanks!
Kuniva
--------------------------------------------
|
|
|
|
|
Hi ,
i have a Dialog box which has a combobox and which on clicking a button retrieves the index of the selected item and stores in a integer variable, now how do I access this variable from another dialog box?..
for example:
void CMyprogDlg::OnOK()
{
int com = m_com1.GetCurSel();
}
How do I access the integer variable 'com'from another dialog box? It would be great if someone sends some example source codes.
Thanks,
Deepak Samuel
|
|
|
|
|
You can't. It's a local variable.
You have to expose the value in the dialog class, globally or send the value via a message to another thread/window.
Since you are setting it with OnOK, the traditional way would be to create a member in CMyprogDlg. The function that created the dialog would then read the value if the dialog returned successfully. It would then either store it its own data member or locally, if the new dialog would be created right away.
|
|
|
|
|
how do the follow in c++???
dim srvobj
dim vdo
set srvobj = GetObject("IIS://LocalHost/MSFTPSVC/1/Root")
set vdo = srvobj.create("IIsFtpVirtualDir", "mydir")
'set vdo = srvobj.getobject("IIsFtpVirtualDir", "mydir")
vdo.setinfo
vdo.AccessRead = True
vdo.Put "Path", "c:\tmp"
vdo.SetInfo
thanks and regard!
|
|
|
|
|
class CLogin : public CFormView<br />
{<br />
protected:<br />
CLogin(); <br />
DECLARE_DYNCREATE(CLogin)<br />
public:<br />
enum { IDD = IDD_DIALOG1 };<br />
................<br />
};<br />
class CChangePassword : public CFormView<br />
{<br />
protected:<br />
CChangePassword(); <br />
DECLARE_DYNCREATE(CChangePassword)<br />
public:<br />
enum { IDD = IDD_DIALOG2 };<br />
................<br />
};<br />
BOOL CQLBHApp::InitInstance()<br />
{<br />
.................<br />
AddDocTemplate(new CNewMultiDocTemplate(<br />
IDR_QLBHTYPE,<br />
RUNTIME_CLASS(CQLBHDoc),<br />
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CLogin)));<br />
<br />
AddDocTemplate(new CNewMultiDocTemplate(<br />
IDR_QLBHTYPE,<br />
RUNTIME_CLASS(CQLBHDoc),<br />
RUNTIME_CLASS(CChildFrame),
RUNTIME_CLASS(CChangePassword)));<br />
....................<br />
}<br />
I defined 2 Document Templates in my MDI App......
But I dont know how to call MDIChildWnd of CLogin (or MDIChildWnd of CChangePassword)
I mean:
When user select menu "Login" (ID_LOGIN) => Show Login MDIChildWindow
When user select menu "Change Password" (ID_CHANGE_PASSWORD) => Show Password MDIChildWindow
Could you help me ?
And ...... Login Window, ChangePassword Window have only one instance in my MDI app .......... so that I think I don't need use
Document Template. Is that right ?
Important: my MDI Child Windows must be dialog-base window(I will design controls in these dialogs by Dialog Editor)
please help me .......and a little sample code if possible (I have read MSDN but dont find what I need)
Thank a lot!
|
|
|
|
|
hi,
When I compile the following code:
DISPID dispid;
DISPPARAMS dispParams;
OLECHAR FAR* szMember =_T("updateList");
...
hresult = lpList->GetIDsOfNames(IID_NULL, &szMember,1,LOCALE_USER_DEFAULT, &dispid); //IHTMLSelectElement *lpList=NULL; lpList is initialized before
I always get this error:
error C2440: 'initializing' : cannot convert from 'char [11]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
I can't get any answer from Microsoft, please help solve the problem!!!
Thx.
Alan
|
|
|
|
|
This is just an offhand guess
stick this at the top of the cpp file
#include <atlconv.h>
Here is the conversion
DISPID dispid;
DISPPARAMS dispParams;
char* tmpstr =_T("updateList");
USES_CONVERSION;
LPOLESTR szMember = A2OLE(tmpstr);
hresult = lpList->GetIDsOfNames(IID_NULL, &szMember,1,LOCALE_USER_DEFAULT, &dispid); //IHTMLSelectElement
|
|
|
|
|
It doesn't work, I got the same error.
Do u know other way to solve it?
Thanks
Alan Shen
|
|
|
|
|
"OLECHAR FAR* szMember =_T("updateList");"
how could you have possibly got the same error, the line above was the line that caused the error, and in the code I posted, that whole line is gone. OLECHAR FAR* wasn't even the right datatype for the param.
Maybe your object file is old, try rebuild all.
Here is the conversion again.
stick this at the top of the cpp file
#include <atlconv.h>
Here is the conversion
DISPID dispid;
DISPPARAMS dispParams;
char* tmpstr =_T("updateList");
USES_CONVERSION;
LPOLESTR szMember = A2OLE(tmpstr);
hresult = lpList->GetIDsOfNames(IID_NULL, &szMember,1,LOCALE_USER_DEFAULT, &dispid); //IHTMLSelectElement
|
|
|
|
|
that is the error:
error C2440: 'initializing' : cannot convert from 'char [11]' to 'unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
|
|
|
|
|
To declare a wide char constant, use L"updateList" ( _T("foo") evaluates to L"foo" in unicode, and "foo" in MBCS/ANSI builds)
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|