|
Like Mike said, if the last line of a macro is a \, then the macro spans the next line also
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
if i Write a code that it Creats a CWnd Object in the main Window, how can i capture the mouse event in it ??? i know that this CWnd object has the Function onMouseMove or onLButtonDown or other Functions for Mouse Events but how can i trap them ???
when i move the mouse over that CWnd Object the Focus Set to this object.and in return the Mouse Event of the main window will lose. but it must be exist a way to capture the Events of the Focused window.
I am realy confused
Here is Code:
//When i Right Click CW Creats.
//CW is a Member Variable of the class
void CMyTestView::OnLButtonDown(UINT nFlags, CPoint point)
{
CW=new CWnd;
CW->Create(NULL, "",WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS ,CRect(0, 0, 26,26), this, 0xffff);
}
|
|
|
|
|
CWnd* p = GetParent();
if (p) p->SendMessage(...);
|
|
|
|
|
When I use printf to display a double variable it gives a wrong result, but when I turn to use a cout to do the same thing it just did it right. For example:
...
double getValue()
{return value; // value is a double variable}
...
printf("%d\n", getValeue()); // gives a incorrect result
cout << getValue() << endl; // right
What are the differences between these two methods? Thanks!
|
|
|
|
|
What do you mean by incorrect?
How about an example of the output.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
The problem with the first one is that %d is for ints only, you should use something like %f. Or maybe thats just my hungover brain thinking poo again
|
|
|
|
|
LOL, silly me. I didn't notice that.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
%d is the format spec for integers. Use %lf for a double (think "long float").
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
ummmmm
printf("%d",value);
is for integer values
try printf("%f",value);
for floats or doubles
"traffic lights are for people who can't make their own decisions" biz stuff about me
|
|
|
|
|
You are not using the correct format code in the printf . Try something like this:
double x = 123.456;
printf("This is x: %lf\n",x);
should print the following:
This is x: 123.456 Your original code used the %d format, which is used for int 's.
Software Zen: delete this;
|
|
|
|
|
hi all,
i am stuck.please help. my problem is I want to make a setup program for my vc++ application as we have in VB.can anyone help me out?
thanks in advance
regards
Himanshu
|
|
|
|
|
If you have VC7 Enterprise (not sure about other versions), you have a minimal version of Install Shield with it.
Otherwise you could look at Inno Setup (its free)
http://www.jrsoftware.org/isinfo.php[^]
Dave.
|
|
|
|
|
I suggest you using NSIS, it is a great free installer. You can get it here
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
I used SetWindowRgn(hWnd, hRgn, true); to make part of a window transparent, however, this transparent part of the window is not receiving any mouse message. is it possible to accomplish what I want(receiving mouse message on the invisible part)?
thanks
|
|
|
|
|
SetWindowRgn does not do transparency, it changes the physical shape of the window. If you make a window round, for example, the parts outside the circle (but inside the original rectangle) are no longer part of the window, period, so the window won't get messages relating to those parts.. To do what you want, you need to use 2K/XP and use layered windows.
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
If i call a dialog in Modal form, and it has a few functions defined in it, How can i automatically call the functions when the dialog box opens? Where should they be called? For example, i have a function defined as PlotData(), where/how would i call this function to execute it when the dialog is opened.
Cheers
Ayush.
|
|
|
|
|
Get OnInitDialog to call them, or OnCreate.
Of course, PlotData should be part of OnPaint.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Like Christian said, though I would add the constructor to the list.
1. After object creation: constructor
2. After window creation: OnCreate or OnInitDialog for dialog boxes
I usually try to put any initialization that doesn't require a window
handle in the constructor.
Here's the question though: which is more preferable?
1. Plotting the data (or whatever processing) and passing the
results to a dialog to be displayed.
2. Passing your data to the dialog and adding plotting code
to process it in the dialog class.
(I assume by plotting, he means some sort of processing of
the data, not display.)
i.e. is it good form to add a lot of smarts to the dialog class or
keep them simple and mostly display oriented?
I would think for portability it is 2, but, being lazy and pressed
for time, I usually go for 1.
|
|
|
|
|
hi all,
i m going to develop a database project in VC++ (MFC).
i want to know which databse is more suitable except oracle.
since this project will be available for all. thats why i m avoiding oracle.
my queries:
1) is MY-Sql(free database) is compatible with MFC.
2) is MS-Access supports web enabled feature.
i m waiting 4 reply.
thanks!
regards
ashu
ashutosh agrawal
mail me at:
ashutosh_agrawal78@rediffmail.com
|
|
|
|
|
aashu wrote:
is MY-Sql(free database) is compatible with MFC.
How could it be incompatible ? Anything you can run in Windows, you can run with MFC.
aashu wrote:
is MS-Access supports web enabled feature.
Dunno.
You should download the MSDE from Microsoft, it allows you to write a DB that will run on SQL Server, but for free.
aashu wrote:
ashutosh_agrawal78@rediffmail.com
You know, I would hope you'd have this email as the email for your account, which means this reply to the site will be emailed to you automatically.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Don't use the classes that come with MFC - they are just too old. Use ADO - there are plenty of articles on CP about it. You can use ADO with most databases and is the most flexible solution available.
Michael
Fat bottomed girls
You make the rockin' world go round -- Queen
|
|
|
|
|
I have placed a gif animation Control(Gif89) in my Dialog based application and in a thread i tried to move the gif's control (with a loaded picture) through the bottom of my Dialog using Move Window() function.A delay of 1ms is introduced between successive calls to move window. I use a timer to communicate with an external device connected to serial port. It takes almost 3 seconds to finish communication. During this time my thread seems to be strucked and gif control is not moved over my main dialog.How can i avoid this?.
the code in the thread for moving control is given below
int offsetx=0;//65
int offsety=444;
int step=0;
while(killthread)
{
m_santa.MoveWindow(offsetx+step,offsety,159,76);
Sleep(1);
step=step+1;
if(offsetx+step>483)//314)
step=0;
With regards
Shibu
"Help yourself through helping others"
|
|
|
|
|
Firstly, Sleep() does not have anywhere near 1 ms granularity. Sleep(1) will sleep for about 50 ms probably.
But what's causing the apparent hang is that (I'm guessing here, CMIIW) the thread did not create m_santa , the main thread did. Since messages for a window must be handled by the thread that created the window, MoveWindow() ends up doing a SendMessage() to the main thread, to have it move the window. SendMessage() does not return until the message is processed.
But since the main thread is busy doing your serial port comm, it is not running its message loop. Thus you have a deadlock, the main thread is busy, and the 2nd thread can't continue until the main thread is done being busy.
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Well...depending on the operating system 'Sleep()' will sleep between 10 (Single CPU Windows NT) milliseconds and 50 milliseconds (Windows 98).
I do not know of the top of my head whether Windows 2000 or XP have better resolution...
Ciao, Andreas
"Software is like sex, it's better when it's free." - Linus Torvalds
|
|
|
|