|
You'll have to add support yourself. There's a few examples on CP here[^] which will tell you how to do it.
"Oh, I'm sick of doing Japanese stuff! In jail we had to be in this dumb kabuki play about the 47 Ronin, and I wanted to be Oshi, but they made me Ori!"
|
|
|
|
|
I have a variable int that when I divide by 2, it all on it's own it divides by 4. By playing with it, I figured out that if I mulitply by about the square root of 2 / 2 the computer simply divides by two.
I've even rebuilt the whole project. The int is normally around 3,000,000 and the only thing I can think is that maybe it's larger than it may legally be.
So I tried casting it to double, but I got the same responce. Any and all help is greatly appreciated.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
This is mighty weird. What are the exact lines of code that are doing the division?
|
|
|
|
|
int iDecryptID = m_iID;
iDecryptID /= 2;
return iDecryptID;
By returning m_iID I know that it is, in fact, the divison that is the problem.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Nope, the division is working properly.
The chance of a compiler error is very very very small.
If the output isn't matching the expected value, then the input isn't what you think it is or something else is going on.
With strange problems like this, 99.9999% of the time it is the programmer who is making assumptions that are wrong.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Can you post more context? I'm quite sure that,
#include <iostream%gt;
int Bogus ( int nTest )
{
int iPart = nTest ;
iPart /= 2 ;
return iPart ;
}
int main ()
{
std::cout << "Result of Bogus ( 3000000 ) = " << Bogus ( 3000000 ) << std::endl ;
return 0 ;
}<pre>
will be as expected.
Paul
|
|
|
|
|
Hi all,
I need to abort a procedure upon the user hitting the <esc> key. Could anyone point me in the right direction on how to implement it? Thx,
Ralf.
ralf.riedel@usm.edu
|
|
|
|
|
Well, if it's a console app (not sure for others... may or may not work) you can do something like the following:
if (kbhit())
{
if (getch() == 26)
{
// escape key was pressed!
}
}
And I believe you have to include conio.h. Also, I'm not positive 26 is the escape key... but my gut says it is. And if you are costantly looping through that code, you will know when the escape key was pressed.
Good luck.
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Escape is 27, from memory. However, it's bad to rely on these values, you should use the virtual key constants instead.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
You need to either run your procedure in a seperate thread or use GetAsyncKeyState. To check for escape, I reckon the constant is VK_ESC, but that's a guess. This function tells you if a key was pressed since it was last called, so call it, then do something like:
if (GetAsyncKeyState(VK_ESC))
{
// finish off and go home
}
Actually, the most significant bit is set if the key is down now, and the least significant MAY be set if it has been pressed, so MSDN tells me. The above is how I always did it, and I'd say it's more efficient than bit mashing over and over inside your process.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
VK_ESCAPE
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks for the input. Your suggestion worked just fine. Best,
Ralf.
|
|
|
|
|
Is there anyway to Intergrate MSDN 2003 Library into Visual C++ 6, when i press F1, it says there is no Help System MSDN Availiable, when i goto Options -> Help System Tab, it says MSDN 2003 isnt installed.,
Is there anyway to get MSDN 2003, to be avaiable for Visual C++ 6
|
|
|
|
|
Im not sure about 'MSDN 2003' as such - I know there's a MSDN set that comes (or used to come) with VC++ 6, I havnt had any problems installing that - maybe you need this as a 'base set' before you can install more recent ones ..
'G'
|
|
|
|
|
The MSDN version that came with VS6 integrates with the product help system, and the updates through (I believe) October 2001 did also. Updates since then can be installed, but not integrated with the product help. You can still use them as a standalone resource, though.
Some people think of it as a six-pack; I consider it more of a support group.
|
|
|
|
|
Check out Tools->options->helpsystem
how it helps.
God is Real, unless declared Integer.
|
|
|
|
|
Hello,
I have a dialog box that contains a static text field. The field is just empty and serves as a box that I want to write a number into later. When I use SetDlgItemText I can set the value of the static text field. If I try to call SetDlgItemText from a different thread then I can't seem to get it to work. Anyone ever encounter this problem?
The thread I'm trying to call SetDlgItemText from was created by the thread that the dialog box is part of, so I guess it would be a child thread trying to update a static text box in the parents thread. Here is what the code looks like:
sprintf(static_message,"%8.3f",measured_value_float);<br />
if (chan_num_int == 101)<br />
{<br />
strcpy(static_message_101,static_message);<br />
}<br />
if (chan_num_int == 106)<br />
{<br />
strcpy(static_message_106,static_message);<br />
}<br />
Right now I'm just moving the values into the variables that start with static_message_10N. The dialog then checks these global variables every second and calls SetDlgItemText itself. I would think that it would be much cleaner if I could just have the other thread do it.
Thanks,
Robert
|
|
|
|
|
I have some additional information. When running the code in debug I found that the value of hdlg in the code above was zero. That explains why the SetDlgItemText was not working. This presumably comes from my main dialog window code. The routine above has an
extern HWND hdlg;
so as to specify that the hdlg is declared in a different file. When looking through my dialog routine the interesting thing is that there does not appear to be anywhere that the variable hdlg gets set!
Here is the code that creates the dialog box in question that doesn't return until the dialog box goes away...
return DialogBox(hInstance,
MAKEINTRESOURCE(IDD_DIALOG1), <br />
NULL,<br />
(DLGPROC) DialogProc); <br />
When you look into DialogProc you see the following...
BOOL CALLBACK DialogProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)<br />
{<br />
<br />
if (t_win_msgs < DBG_SIZE)<br />
{<br />
GetTimeStampStr(ats, char_ts, char_ts2);<br />
strcpy(win_msg_time[t_win_msgs],char_ts2);<br />
win_msg[t_win_msgs] = uMsg;<br />
strcpy(win_msg_text[t_win_msgs],"");<br />
if (uMsg == WM_COMMAND)<br />
strcpy(win_msg_text[t_win_msgs],"WM_COMMAND");<br />
if (uMsg == WM_TIMER)<br />
strcpy(win_msg_text[t_win_msgs],"WM_TIMER");<br />
if (uMsg == WM_AGILENT)<br />
strcpy(win_msg_text[t_win_msgs],"ser agi");<br />
win_hi_wp[t_win_msgs] = HIWORD(wParam);<br />
win_lo_wp[t_win_msgs] = LOWORD(wParam);<br />
t_win_msgs++;
}<br />
<br />
switch (uMsg)<br />
{<br />
<br />
case WM_AGILENT:<br />
return 1;<br />
<br />
case WM_INITDIALOG:
<br />
InitDialogProc(hdlg, uMsg, wParam, lParam);<br />
return 1;<br />
<br />
case WM_TIMER:<br />
<br />
SetDlgItemText(hdlg,IDC_STATIC_1,(LPCSTR)static_message_101);<br />
SetDlgItemText(hdlg,IDC_STATIC_2,(LPCSTR)static_message_106);<br />
return 1;<br />
The hwnd variable is the first parameter passed into DialogProc. It is then passed as the first parameter to InitDialogProc. It is used in there to do a bunch of stuff including naming the window title, etc...
But as I mentioned it does not appear to actually get set anywhere that I can see, unless it is somehow done automatically? If so, then why can't I see it in the other thread?
The description of the DialogProc routine seems to show that the first parameter (hdlg) is passed in. In my code, this is not getting set prior to the call to DialogBox that has DialogProc as the 4th parameter. When I set a break in DialogProc on the first line and then check hdlg, it has a non-zero value. When did that get set?
I should mention that the calls to SetDlgItemText under WM_TIMER are the ones that are working. I would just prefer to have the other thread set them directly instead of having to poll them in this manner form the main dialog box.
Robert
|
|
|
|
|
Well, I have it working now but I'm still not sure exactly what is going on. This much I can say. The variable "hwnd" within DialogProc only exists when in the DialogProc routine. So, I created another variable called global_hdlg which I set to hdlg every time DialogProc is called.
The other thread then declares global_hdlg as extern and passes it into SetDlgItemText.
There must be a cleaner way to do this?
Robert
|
|
|
|
|
Hi,
I am using ADO to connect with Database i.e _connectionptr. I want to know the table names.
But doesn't able to solve the problem.
I feel very thanksful if anyone helps me in this regard.
|
|
|
|
|
|
Hi,
Thanks for the solution, but the fact is that i have just at the stage of completion of Application and you know if i want to use ADOX i have to do lot of changes in code and that may create lots of problems for me.
So , if u know some other solution by using _connectionptr and _recordsetptr then please advice me.
|
|
|
|
|
ADO and ADOX go hand and hand. ADOX is an extension to ADO that gives you access to the things ADO left out. It has been a long time since I have worked with ADOX so I can not tell you any details.
John
|
|
|
|
|
Hi all;
I am buidling an SDI application which has a WebBrowser control in my view class (this project contains a single view). I could not use the webbrowser elsewhere as i could not access it. Someone suggested that i put the variables as "public" in the view class. This is ok. The problem is now, how can i access the variable anywhere in my application.
I have tried MyView::webbrowser.navigate("......);
but it does not work. Can somebody please help me,
Thank you
Krugger
Plan tomorrow todays cos' tomorrow will be too late..
|
|
|
|
|
Hi Krugger,
You must say to the compiler which view the WebBrowser belongs to, even if you know that's only one such view:
CFrameWnd* pMainWnd=(CFrameWnd*)AfxGetMainWnd();
MyView* pView=(MyView*)(pMainWnd->GetActiveView());
pView->webbroser.navigate(...); Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|