|
|
Thanks mike for replying my message but what I wanted to know (and still don't know) is how to post the message.
<br />
CWnd* pWnd = GetParent();<br />
<br />
pWnd->SendMessage();<br />
Thanks everyone !!
Rafael Fernández López.
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
|
Yes, that's what I want to do, but I don't know the syntax of SendMessage. Could you type an example please ?
Thank you.
Rafael Fernández López.
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
From MSDN:
CWnd::SendMessage<br />
LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );<br />
...<br />
Sends the specified message to this window. The SendMessage member function calls the window procedure directly and does not return until that window procedure has processed the message.
So in your case it would be
GetParent->SendMessage(WM_LBUTTONDOWN, vkeystatus, MAKELPARAM(x,y) );
GetParent->SendMessage(WM_LBUTTONUP, vkeystatus, MAKELPARAM(x,y) );
HTH
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Thank you Jonas Larsson, Mike and Greg for your help. It was very useful.
Rafael Fernández López.
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
Hi guys,
I think this is an embarassingly dumb question but it's causing me grief so I thought I'd ask for help.
I have 2 list boxes in a modal dialog. I know how to fill them using AddString() just find but this relies on having created the dialog with Create() then accessing. When I create the dialog using DoModal() how/where/when do I use AddString()?
Any help much appreciated.
S
|
|
|
|
|
Hi,
since it is a Modal Dialog initialize the List Ctrl in the OnInitDialog() method.....
something like this:
BOOL CYourDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_FirstList.AddString(...);
m_SecondList.AddString(...);
...
...
}
hope this helps ya
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Cheers Yaron ... thanks a lot man, it worked first time.
|
|
|
|
|
i have a query: i use a dialog to take in user input for a rect dimensions but i tested it using AfxMessagebox and encounter assertion error, may i know where is the problem? i have a variable m_length of float type.
void Dialog :: OnOK
{
UpdateData(TRUE);
float length=m_length;
AfxMessageBox(length);
}
|
|
|
|
|
Hi,
this could occur due to several problems:
1) look in the DDX method of the class that the m_length is defined there.
if it is not than the UpdataData(TRUE) will not be valid for m_length.
2) use format string for the float variable as follows:
CString szLength;
szLength.Format(_T("%d"),m_length);
AfxMessageBox(length);
hope this helps ya
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
the DDX method shows:
DDX_Text(pDX, IDC_LENGTH, m_length);
does that mean that the UpDateData(TRUE) is unable to take in the float m_length? i need my member variables to be float preferably because i am using it for OpenGL rendering and as i encountered problems putting my variables into OpenGl that why i was testing to check whether my function can take in the float values.... is there a better way?
|
|
|
|
|
ok, i see the problem now...
open the class wizard (CTRL+W) and go to the definition of IDC_LENGTH and delete the m_str_length member. add a new member called m_length which will be not from CString type but from float type. then you should see an entry in the DDX as follows:
DDX_Text(pDX, IDC_LENGTH, m_length);
now the update data will hold the number within the m_length...and all u have to do is convert it to string and display it....
hope this helps ya
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
erm okie thanx but actually i made a typo error in my earlier message, it is really DDX_Text(pDX, IDC_LENGTH, m_length) already.. so that means AfxMessageBox cannot display a float directly? need to convert to String?
|
|
|
|
|
yes, just do it like this:
UpdateData(TRUE);
CString sz;
sz.Format(_T("%f"),m_length);
AfxMessageBox(sz);
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
coda_x wrote:
so that means AfxMessageBox cannot display a float directly?
Correct. Check the docs and the function prototypes.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
You cannot use AfxMessageBox with a float variable. You need a CString with the float variable this way:
<br />
void Dialog :: OnOK<br />
{ <br />
UpdateData(TRUE);<br />
float length=m_length;<br />
CString my_string;<br />
<br />
my_string.Format("%f", length);<br />
<br />
AfxMessageBox(my_string);<br />
<br />
}<br />
That's all, hope it helped.
Rafael Fernández López.
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
Hi all,
I have a problem.
I am reading a string from a vector :
CString szLine = m_vec[1];
int iLen = szLine.GetLength();
now i try to convert it to wide char (unicode) :
wchar_t* pwcSymbol = new wchar_t(iLen + 1);
MultiByteToWideChar(CP_ACP,MB_COMPOSITE,szLine,iLen,pwcSymbol,iLen);
then i just perfrom delete to the wchar_t* :
delete pwcSymbol;
i get an exception......
I read in the MSDN that the out buffer length (the 5th parameter in the MultiByteToWideChar) suppose to be more that the length of the multibyte string..... i am not sure what that means???
can any1 help?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
ok i found the way,
instead of dynamically using wchar_t* i can easily use
std::wstring , the class handles the memory buffering itself....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Wrong sort of brackets. You need to allocate an array, not a single wchar_t .
wchar_t* pwcSymbol =
new wchar_t<font color="red">[</font> iLen + 1 <font color="red">]</font>;
delete <font color="red">[]</font> pwcSymbol; The parentheses () indicate a call - to a constructor in this case, meaning that your original code will allocate memory for a single wchar_t and initialise it to the value iLen + 1 .
|
|
|
|
|
thanks man,
that helps too
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi
How to know the parameters of an exported function from a dll. like NTDeleteFile exported from NTDLL.dll
Thanks
|
|
|
|
|
you can undecorate parameters of C++ functions using dependency walker but unfortunately it does not work with C functions
|
|
|
|
|
It's quite simple, you just disassemble the function and work it out from the stack.
Seriously, why do you want to use NtDeleteFile rather than the Win32 DeleteFile ? NtDeleteFile knows nothing of current directories and requires a fully specified path, in NT object manager format. In general, it's better to use the Win32 functions.
If you're looking to reuse a DLL for which you don't have documentation, my advice is not to bother. If the function is undocumented, you should consider it to be an implementation detail which could change in future versions of the DLL. Don't use it.
|
|
|
|
|