|
I place a ms serial communiction control (msComm)on a dialog,and make this dialog as a diaolgbar to us,But I cann't use the mscomm control to open any
serial port,seems the control isn't enabled to use on dialogbar.
I know other control such as button can add UpdateUI memeber function by hard to use enable it ,but how to enable the mscomm control to use?
Any one On the GuRu can help?
Thanks
|
|
|
|
|
Hi, all
I am writing a class that creates and maintains a window/control. The problem is that I can’t seem to give the class its own private callback function (the Window Procedure alias WndProc); the VC++ complier simply gives a type cast error when giving out the function pointer. I thought about why and I assume that the reason lies in the different structure between class functions and global functions. But is there a way to go round this, like force the compiler to construct the class function as a global function (assuming that’s the case)? If that’s not that the case, then why does the compiler give a type cast error? And is it possible to have callback function as a class member or at least give the class some sort of private callback function? And oh yes, I know I can use MFC but I simply prefer not, I want to know if can be done without its help.
Thanks in advance
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
I want to help you
but I know just a little about callback function
I ever solved a callback function as a private static member function on the base of other people in VC, which perhaps develops from MFC
It works well.
|
|
|
|
|
Thanks that worked (making the function static), but another problem came up. I get a link error saying “illegal reference to data member 'Class::X' in a static member function”, whenever the static function uses other class members (both variables and other functions). How can I solve this?
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
Usually you can pass a pointer on your main window to the callback function. If the parameter of the callback function is LPVOID, you will have to typecast it to your window type.
if it looks like
CMyDialog::callbackfunction(... , LPVOID pointer)
use it like this :
callbackfuntionc(...,this);
and in the function
CMyDialog::callbackfunction(... , LPVOID pointer)
{
CMyDialog *pMain=(CMyDialog*)pointer;
pMain->m_variable=0;
}
~RaGE();
|
|
|
|
|
static function can not access non-static members.
Look at the Code Project FAQs for anouther way to implement callback functions.
INTP
|
|
|
|
|
You can define a static varible member in the class including callback function
if something has happened you can change the varible
of course it is an indirect way.
|
|
|
|
|
Boost can let you do this. Here's a starting point, but for a much better example download boost and look at the sample code for boost::thread
http://www.codeproject.com/vcpp/stl/boostintro.asp#xx563708xx[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
This is standard C++ stuff which you should find in any good C++ Reference book.
Here is a code snippet:
class CBookmarks
{
public:
void ScanBookmarks( void (CBookmarks::*Scan_Func)( const BMRK, const ulong, const ulong ), const ulong var1, const ulong var2, const LN_NUM ln_num );
};
void
CBookmarks::ScanBookmarks( void (CBookmarks::*Scan_Func)( const BMRK, const ulong, const ulong ), const ulong var1, const ulong var2, const LN_NUM ln_num )
{
}
bits
CBookmarks::ClmChanged( const LN_NUM ln_num, const LN_CLM clm, const int dir )
{
m_changed_bookmarks = 0x00;
ScanBookmarks( _ClmChanged, clm, dir, ln_num );
return m_changed_bookmarks;
}
void
CBookmarks::_ClmChanged( const BMRK mp, const LN_CLM clm, const ulong dir )
{
if ( mp->m_ln_clm >= clm )
{
mp->m_ln_clm += dir;
MASKON( mp->m_status, MOVED );
BITON( m_changed_bookmarks, mp - m_bookmarks );
mp->m_ln_oclm = MARK_OFF;
}
}
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I created two projects, whose names are same
How to know their pathes respectively
(VC6)
|
|
|
|
|
U can use GetModuleFileName
Arjan.
|
|
|
|
|
Hi,
use GetModuleFileName(NULL, Buffer, BufferLength);
Regards
Frank
|
|
|
|
|
Yeah,
sorry
but you have mistaken my meaning
I want to know the path through Microvisual Studio 6.0 window not by programming
that is,look at Microvisual Studio 6.0 interface on computer screen and then know the path of my project
Have I expressed my meaning clear?
|
|
|
|
|
Go into the fileview (the third tab, near ressource), right-click the workspace name and choose properties.
~RaGE();
|
|
|
|
|
Thank you!
Now I know the way
I think that
it is not very easy
and the microsoft corps should show the path at a more outstanding position
thank you again!
|
|
|
|
|
You can also just right click any editor window and select "Properties" from the popup menu.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi to everybody!
Is somebody knows, how can i listen to specific pin notification of a Serial Port or a Parallel Port ?
|
|
|
|
|
I have written an MDI application.
I wolud like to create on the desktop of my application
an hyperlink to my web page
How can I do this?
I'm able to create an hyperlink in the dialog box but I'm
not able to create it on the desktop of my application
|
|
|
|
|
What do you mean with the desktop of your application ? If it is in the toolbar, then you would consider using a rebar, with Chris' CHyperLink control.
~RaGE();
|
|
|
|
|
|
I want to start DirectX programming. I get the SDK and samples with it, but I want some tutorial about how to begin. The document with the SDK is not good for beginnig.
Mazy
No sig. available now.
|
|
|
|
|
IMHO, compared with what is available on the net, the SDK samples are not bad for getting started. There is a DirectX forum at <www.gamedev.net> You'll probably get more leads to tutorials from the posters there.
Good Luck with DirectX!
-Roger
|
|
|
|
|
Thanks Roger. I find GameDev.net forum.
Mazy
No sig. available now.
|
|
|
|
|
Here are some code about DeviceIoControl:
BTemp=DeviceIoControl
(
hDrive, // handle to device
IOCTL_STORAGE_CHECK_VERIFY, // dwIoControlCode operation
NULL, // lpInBuffer; must be NULL
0, // nInBufferSize; must be zero
NULL, // lpOutBuffer; must be NULL
0, // nOutBufferSize; must be zero
&BytesReturned, // number of bytes returned
NULL // OVERLAPPED structure
);
this function "DeviceIoControl" is to check whether the floppy disk has been changed(If the function succeeds, the return value is nonzero.If the function fails, the return value is zero.)
Something wrong happens here:
BTemp is a minus when I test on a wrong floppy device which does not work well while it is plus when on a work-well floppy device
does this mean that a returned minus value says the floppy device is error?
|
|
|
|
|
Hi All,
I have a webbrowser object and I want to open the new window link in same parent window and not let the child window to open. I searched for new window method and found it as..OnNewWindow2(LPDISPATCH FAR* ppDisp, BOOL* Cancel)..where assigning cancel to to non zero value does the job of letting open the IE in new window..but I dont know how to get it to navigate to the link user has clicked on...I found an example in VB but that takes in the parameter as URL and in VC..i wasnt able to find any such method..I need it to be done..can anyone out there help me out..any help or pointers are highly appreciated..Thanks a lot in advance..
Himanshu
|
|
|
|