|
You have two choices here. You can either construct and pass a CDBVariant or you can pass a CString and convert the returned value:
CString strID;
recset.GetFieldValue("Address ID",strID);
long iID = atol(strID);
CDBVariant v;
v.Clear();
v.m_dwType = DBVT_LONG;
recset.GetFieldValue("Address ID", v);
I'm typing this without testing it, but this should be very close to what you need.
Cheers,
Tom Archer
Author, Inside C#
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the affairs of others.
|
|
|
|
|
i think the best way is
take an object CString strID;
use the following for conversion
strID.Format(" %d ",iID);
strID is a string object containing 5 as string value
u can convert anything into string
eg:
pointer ptr can b converted as
strID.Format(" %x ",ptr);
|
|
|
|
|
I'm building a Document/View based program.
When a user wants to use the program the following should happen:
a) A login dialog box should appear on the screen
b) If a user enters a valid login the program should become accessible
c) If a user enters invalid login information the program should end
d) And also if the user presses Cancel the program should end
something like this:
CDlgLogin dlg;
int nLogin = dlg.DoModal ( );
if( nLogin == IDOK )
{
//check login information
}
else if( nLogin == IDCANCEL )
{
//shutdown the program
}
What I'm not sure about is WHERE to put this information
I've tried the "ProgramView.cpp" and "MainFrm.cpp" files but I always get silly access violations or something like that when a user presses "Cancel"
What do I need to do for this to work ? Please please help me if you can
Best wishes from Iceland
Solini
|
|
|
|
|
The easiest way is to put that stuff into the CYourApp::InitInstance
Regards
Thomas
Finally with Sonork id: 100.10453 Thömmi
Disclaimer: Because of heavy processing requirements, we are currently using some of your unused brain capacity for backup processing. Please ignore any hallucinations, voices or unusual dreams you may experience. Please avoid concentration-intensive tasks until further notice. Thank you.
|
|
|
|
|
A good place to insert this is in your CWinApp -based InitInstance , just before anything else. If the login fails, just return FALSE .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
we have a login screen just as you describe
at the end of InitInstance() we post a message to ourselves mimicking the 'log on' toolbar button
the logon box pops up very nicely
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
Thank you everyone... putting the doModal( ) into the InitInstance function worked perfectly
|
|
|
|
|
I need to change the background color of an OCX composite control at a regular basis. When I do this the composite control and all controls within are redraw. This causes the application to flicker. Can this somehow be prevented?
|
|
|
|
|
Can you modify the source code of the OCX? If so, consider using double-buffering when painting. Check Keith Rule's Flicker Free Drawing In MFC.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanx for yor reply. I can modify the OCX code, however my OCX is a composite control and it seems that the OnDraw is never called, instead the CAXWindowHost::OnPaint. Overloading this call seems tricky, do you know how I can trigger the OnDraw of the composite control?
|
|
|
|
|
Hi,
I have written a small application using DirectShow that plays an MPEG or AVI movie in full screen mode. My code is based on the "playit" sample code that comes with the DirectX SDK (or at least it came with 6.1), and it uses WinAPI. All I want to do is have it so that the movie finishes (exits) as soon as you press any key on the keyboard (or one of the mouse keys, though that's not as vital). This is probably a very dumb question (I am very new to DirectX and not a very experienced programmer in general), but how can I do this? I *think* that I somehow need to send the message EC_USERABORT to the movie window as soon as the user presses a key. I have tried using put_MessageDrain() and so on, but it doesn't seem to recognise my window - or at least, it doesn't work.
This is the main loop of the PlayMovie() function:
long evCode, param1, param2;
bool bcomplete=false;
while (hr = pME->GetEvent(&evCode, ¶m1, ¶m2, INFINITE), SUCCEEDED(hr))
{
switch(evCode)
{
case EC_USERABORT:
bcomplete=true;
break;
case EC_COMPLETE:
bcomplete=true;
break;
}
hr = pME->FreeEventParams(evCode, param1, param2);
if(bcomplete==true){break;}
}
If anybody could tell me how to get my movie to close as soon as the user hits any key, I would be very grateful.
Many thanks for any help,
KB
P.S. Apologies - I posted a similar message a few days ago; however, I am still stuck and my old post seems to have been lost pages back...
|
|
|
|
|
Hi, is it possible to get the information of the display card through C++? Any sample code? Thanks.
|
|
|
|
|
EnumDisplayDevices to get the video cards
EnumDisplayMonitors for the monitors
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
How do I set the mouse position (in absolute coordinates) in Win32?
Thanks.
Isaac Sasson,
Lean, mean posting machine!
Sonork ID 100.13704
|
|
|
|
|
Use this function:
BOOL SetCursorPos(
int X,
int Y
);
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks! I forgot the function name and I'd hate to look through MSDN.
Isaac Sasson,
Lean, mean posting machine!
Sonork ID 100.13704
|
|
|
|
|
I think that looking through MSDN is a skill that you become good at only after years of practice and experience.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
The good thing though is that it will take years to complete your first search, so by the second one you'd be an expert...
Isaac Sasson,
Lean, mean posting machine!
Sonork ID 100.13704
|
|
|
|
|
SetCursorPos(x, y) where x and y are screen coordinates.
If you have client coordinates or coordinates relatives to another window, then you can uses function like MapWindowPoints or ClientToScreen to do the proper conversion.
Philippe Mori
|
|
|
|
|
Hi, could anyone give me an answer to this.
We have a long operation involving that we have wrapped with a CWaitCursor. However, during the processing, the cursor flickers back and forward to the pointer.
Any ideas what we can do to keep the hourglass visible?
Cheers,
Steve.
if(E_NOINTERFACE == pThat->QueryInterface(IID_IUnknown,(void**)&pUnk))
{
// I aint no pUnk bitch!
}
|
|
|
|
|
Whenever you window need redraw, the cursor is updated. If you want to stick to your CWaitCursor, you need to overwrite SetCursor().
|
|
|
|
|
Ahhhh,
documentation.
Maybe I should have read it in the first place.
Thanx for your help.
Steve.
if(E_NOINTERFACE == pThat->QueryInterface(IID_IUnknown,(void**)&pUnk))
{
// I aint no pUnk bitch!
}
|
|
|
|
|
I think it's simpler to just do:
AfxGetApp()->DoWaitCursor(1);
doSomething();
AfxGetApp()->DoWaitCursor(-1); /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
If fact, temporary cursor are restored as soon as the mouse is moved (see SetCursor doc) and in pratice, it means that the cursor will be restored if windows messages are processed which may be the case if something with a message loop is called (COM apartment switching, message box,...).
The only way to ensure that the wait cursor stay displayed is by calling something that will do a permanent change of the cursor (or also by processing WM_SETCURSOR) or by associating a NULL cursor with your window.
In MSDN documentation, it is said that the cursor must be restored if an operation cause the cursor to be changed (see CWaitCursor::Restore).
Philippe Mori
|
|
|
|
|
Hi guys n gals, how do i disable a push button at runtime?? Is there a function in CButton class to disable a button? I couldnt find one.
thx
bye
|
|
|
|