|
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
|
|
|
|
|
Is there a rule of thumb as to when new code should be put into a new class when including a header.
Let say I need to use
#include extrastuff.h
in theory I could make it a new class but if I'm only using one function or proc from it, it then seems a waste of time. If I'm using multiple stuff from the header it makes sense.
Any better logic welcomed.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining.
Said by Roger Wright about me.
|
|
|
|
|
Simple - if the group of functions together represent a logic object or partitioning of logic, then they should be a class.
A class called 'CExtraStuff' is a bad idea, use a namespace instead.
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
|
|
|
|
|
Christian Graus wrote:
Simple - if the group of functions together represent a logic object or partitioning of logic, then they should be a class.
I am realising I have been using classes for behavior partitions instead of logic, maybe I should change.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining.
Said by Roger Wright about me.
|
|
|
|
|
Hi forum
well this is my problem my project involves sending messages to a directx or an OpenGL application i have used SendInput it works for all the normal windows and it even worked for a small OpenGL demonstration game but games like Need for Speed and others do not respond to the keys that i send so anyone with any knowledge of how to deal with the situation
Thanks in advance
|
|
|
|
|
Hi there...
I like to do something, let me describe it with "create a dialog in another dialog".
I currently have a dialog with some controls. I want to reuse this collection of controls in another dialog too. Instead of creating everything again, I like to reuse my controls and it's controling code (object orientated design).
So I thought about a kind of dialog or "child control" that takes a dialog resource (where I arrange my controls) and put it in the middle of a existing dialog.... there it should act like a single control. Well, I hope I could describe what I mean.
Example: An exitsing example close to what I want to do is a property sheet. A property sheet takes AFAIK a dialog resource with a bunch of controls and you can put that inside a dialog (and do even more stuff).
Thanks for pointing me into the right direction! Sorry if I sound like a baby trying to code GUI, my knowledge of Windows GUI is poor.
|
|
|
|
|
You can embed a dialog in another one.
You create the embedded dialog as modeless in WM_INITDIALOG handler as a child window of the main dialog, then set it's size and position.
I use an unvisible placeholder control in resource editor to define size and position of the embedded dialog inside the main one.
Some code (MFC, m_nesteddlg is a CDialog derived class):
void CLineLinPrtPage::CreateNestedDialog()
{
m_nestdlg->Create(m_nestdlg->GetID(),this);
CRect r;
GetDlgItem(IDC_PLACEHOLDER)->GetWindowRect(&r);
ScreenToClient(&r);
m_nestdlg->SetWindowPos(NULL,r.left,r.top,r.right-r.left,r.bottom-r.top,SWP_NOZORDER | SWP_NOACTIVATE);
m_nestdlg->EnableWindow();
}
Pavel
Sonork 100.15206
|
|
|
|
|
thanks, sounds interesting!
Can I ask what for you used it.. what have you done with your nested dialogs?
|
|
|
|
|
Context sensitive part of a form.
You select a communitication protocol in the main part and get protocol specific parameters in the nested parts.
Also when a new protocol is added, only the nested dialog needs to be created.
Pavel
Sonork 100.15206
|
|
|
|
|
thanks
|
|
|
|