|
Jörgen Sigvardsson wrote:
That may not always work, as you can superclass dialogs.
I got an idea about using one of the dlg based functions on a non-dlg window and eventually found this system error:
ERROR_WINDOW_NOT_DIALOG - The window is not a valid dialog window
The problem is, the only dialog function I can find that returns the value is EndDialog.
if (!EndDialog(hWnd, 0))
{
if (GetLastError() == ERROR_WINDOW_NOT_DIALOG)
}
else
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
EndDialog is not the ideal function in most cases.
How about MapDialogRect(), or GetDlgItem()?
--
An eye for an eye will only make the world blind.
|
|
|
|
|
Tried GetDlgItem before, didn't work. MapDialogRect does work though.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
H@llo
I have a class with some memberfunctions and like to refer to these by unsing functionpointers.
all my tries ends up in errors
some sample here:
<br />
class myCom<br />
{<br />
public:<br />
int send(int,char*);<br />
int read(int,unsigned int,BYTE*);<br />
};<br />
<br />
class myCom;<br />
typedef int (*cdout)(int ,char* );<br />
typedef int (*cdread)(int ,unsigned int ,BYTE* );<br />
class action<br />
{<br />
myCom* mCom;<br />
...<br />
};<br />
<br />
...<br />
mCom = new myCom;<br />
...<br />
cdout test = mCom->send;
or<br />
cdout test;<br />
test = mCom->send;
...<br />
Anyone any idea??
THX
|
|
|
|
|
you have
typedef int (*cdout)(int ,char* ); and
int send(int,char*);
but send is a member function... its synopsis is not what you wrote. it gets an implicit parameter (this ). send() actually has 3 parameters.
if you want to use it, you must declare it as a static function.
but if it uses data members of its class, it won't see them anymore.
so you'll have to pass a new parameter explicitely to your send() function to allow it accessing the members. You'll also have to change the cdout declaration...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hallo
OK - got it so far.
But at least i like to send this functionpointer to a created dll.
So ifsend() is static i have to change to much code.
Changeing the typedef restricts the needed parsing possibility
for my dll.
I'm sorry, but i'm not very good in c programming. Is there any other fast possibility to call a dll function that communicating with class member functions?
THX
|
|
|
|
|
just put send not a member function... (say it is global... or at least, from within a namespace of your own)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
|
Hello brothers...
I tried my best but could not get solution to my problem. Please help me.
I can not understand why this error message is comming. I have changed my code but error is still there.
My code is as follows.
void CMyThreadDlg::OnOK()
{
if (m_check) // if check box is checked
{
AfxBeginThread(ThreadProc,NULL,THREAD_PRIORITY_NORMAL,0,0,NULL);
MessageBox("Thread Started");
}
CDialog::OnOK();
}
UINT ThreadProc( LPVOID Param )
{
ofstream fout;
fout.open("thread.txt");
for(int i=0;i<=100;i++)
{
fout <<i <<' ';
}
fout.close();
return 0;
}
Error message is,
<b>AfxBeginThread' : ambiguous call to overloaded function</b>
We Believe in Excellence
|
|
|
|
|
maybe ThreadProc is an identifier already existing...
you could either change its name, or use the :: scope operator...
(and please explain better you problems next time...)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
I think you ar passing to many parametrs to AfxBginThread() (I don't have MSDN on this computer...).
Anyway try this :
void CMyThreadDlg::OnOK()
{
if (m_check)
{
AfxBeginThread(ThreadProc,NULL);
MessageBox("Thread Started");
}
CDialog::OnOK();
}
[EDIT]
I've checked and you are passing the right parameters,so you have 2 more options:
1. Declare your thread on top of your file:
UINT ThreadProc(LPVOID lpvoid);
and then use it.
2. You already have a function calld ThreadProc.
Try a different name to your thread.
Regards,
Eli
|
|
|
|
|
|
thanx,I forgot it....
Eli
|
|
|
|
|
Did you try declaring ThreadProc before using it. Something like
UINT ThreadProc( LPVOID Param );
void CMyThreadDlg::OnOK()
{
...
IIRC, the compiler creates a function that takes and returns void if you don't define one before using it. Or is it only a C language feature?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
S. Senthil Kumar wrote:
Or is it only a C language feature?
yep. C only...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
hi
is it possible to send a BSTR to a method expecting a _bstr_t?
|
|
|
|
|
void function(_bstr_t string);
BSTR BSTR_string;
function(_bstr_t(BSTR_string,true)); The bool argument to the _bstr_t constructor specifies whether you want to copy the string or simply attach it to the _bstr_t object you're creating.
Software Zen: delete this;
|
|
|
|
|
The task is to create non-title dialog which allows user to move it arround the desktop.
As we all knew, user can move the normal dialog by click left button and drag the mouse while it is in the Title area. My dialog have no title, how I can perform the task.
I have tried to handle events WM_LBUTTONDOWN and WM_MOUSEMOVE in the WindowProc procedure of the dialog.
I can move the dialog, but the problem is:
The dialog can't move smoothly. It is flicking
Does any one help me to handle the task better?
Thanks very much
TDH
|
|
|
|
|
Add a handler for WM_NCHITTEST and just return HT_CAPTION .
UINT CMyDlg::OnNcHitTest(CPoint point)
{
return (HTCAPTION);
} /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I'll have to remember that one.
Software Zen: delete this;
|
|
|
|
|
I been working on this clock replacement program because I never find
any open source ones.
I been having problem with the code and cant find a way to auto
update/refresh my systray to fit my clock replacement.
I already looked all over google and news groups.
Take a look at those pics
before I run the program
http://69.50.187.114/~area51/before.gif
after I run the program = notice I lost my AIM icon.... it overlapped
the AIM icon.
http://69.50.187.114/~area51/after.gif
my program is MFC based.
I decided to include my code for people to take a look at.
http://69.50.187.114/~area51/Start_Button_Clock_Changer.zip
Click on the "Change Clock" button on the dailog. you will see what I
mean.
|
|
|
|
|
What would be the best method for printing to the screen without flickering? I tried using GDI but it still flickers.
I want to *draw* lines to the screen. The only prob is that I want it intended to be run with a DirectX game which flickers every second.
What would be the best way to do it?
|
|
|
|
|
|
Using IsClipboardFormatAvailable function to check CF_OWNERDISPLAY
if (IsClipboardFormatAvailable(CF_OWNER_DISPLAY))
{
//Process...
}
Thanks in adavnce
|
|
|
|
|
Is there a question in here some place?
|
|
|
|