|
Hi,
i need to run a program from my VC++ app. In Delphi there was an "ExecuteFile" , can someone help me with the equivalent from VC++ ?
|
|
|
|
|
Try CreateProcess() or ShellExecute() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
I am using CSplitterWnd::GetRowInfo and GetColumnInfo to get the height and width of one of the panes created by the splitter. It is working perfect until a certain height and width, but once I try to increase further (by moving the splitter to the right or bottom), the resize works perfect, however, I don't get correct values for the height and width. What happens is, at a certain value for height and width, MFC will return me the same value no matter how much I move the splitter to the right or bottom, even though I can see the the resizing is done perfectly well. And, these values are smaller on Windows 2003 and XP, compared to 2000, they are random values.
Thanks in advance. Any help is appreciated.
|
|
|
|
|
Is there a way to create a activex dialog window. Basically an windowed activex control.
Thanks
|
|
|
|
|
I am working on an SDI application , but have stripped out the Doc View Concept, just preserving the CMainfrm class . The component that I added was :
Two CDialog objects(same class) that I create from within the CMainFrm class . I have the following questions
1. I create the 2 Dialog objects and they show up just fine , but unlike a View their title bars are not highlighted in blue . I would really desire this feature as it tells the user which Dialog they are working with . Here are the styles that I assigned to the Dialog resource using the IDE :
Style = "Child"
Border = "Thin"
and checked the "Title" checkbox
2. I need to be assigning separate names to both of these dialogs . What is the API call to set the titleName : say like "MyDialog1" and "MyDialog2" as part of the title bar .
Any suggestions ?
|
|
|
|
|
you can do this in the dialog's OnInitDialog() :
this->SetWindowText("my dialog title");
or
this->SetWindowText(m_strTitle); where m_strTitle is a string previously stored (by the caller why not) with the title.
however, I am surprised to see you want a title-bar with a "child-style" dialog (which shouldn't have any).
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
I have a problem with a VC++ (6.0) dialog based application running under Windows XP. From a modal dialog, the user initiates some long-running activity, in a loop, that can take as much as 10 - 15 minutes to complete.
If during the processing, the user covers the modal dialog with another window, even for a second or two, and then re-exposes it and clicks in the dialog, on Windows XP, "Not Responding" is displayed in the window title bar, causing the user to believe the app has died... but of course it hasn't.
This behavior does not seem to occur under Windows 2000 or NT.
There are a whole host of reasons why it would not be a good idea, in this particular situation, to start a new thread to do the processing, freeing up the dialog to respond to whatever messages XP is sending to determine if it is alive.... so.... Short of a separate thread... any ideas would be really, really appreaciated
Thanks,
Doug
Doug Knudson
|
|
|
|
|
The only other approach is to implement a message loop within the long running function. This used to be general practice back in the 16 bit days and I think if you search here on codeproject, you'll likely find an article that describes how to implement what you are looking for.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Doug, check out the section "Responding to user input while performing a long task" in this[^] article.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Doug Knudson wrote:
Short of a separate thread
Why not create a separate thread to do the work? It would be the correct solution
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
What you are describing is the textbook case for using a thread, your app must have some FUBAR'd design to preclude this.
But another alternative that doesn't always occur to us Windows guys is to just do the long calculation in a whole seperate process, using any of the several available windows interprocess communications techniques to keep your GUI informed on how things are going.
|
|
|
|
|
Well, you've got your other options. But as David said, putting it in a separate thread is The Right Way. That's kinda what they're meant for, after all.
FWIW, on Win2k and NT, Windows will also determine (at some point) that your app isn't responding. The difference under WinXP is that XP replaces your (unresponsive) window with a dummy window that displays the tile + "Not Responding", and allows the user to close it.
They did this because, after six years of being told that the primary thread was for keeping the UI responsive and to do real work in other threads, we still weren't writing responsive apps.
"The time has come," the Walrus said,
"To talk of many things..."
|
|
|
|
|
Only six years
I thought they have been rpeaching thread usage since Windows NT was released, back in something like 1993
|
|
|
|
|
Maybe. I was stuck on OS/2 then though.
"The time has come," the Walrus said,
"To talk of many things..."
|
|
|
|
|
Hi all,
Oh, how I miss the days of my youth when there was only one "correct" way to solve every problem... and I was always sure what the "correct" solution was to everyone's problems, even when I had no idea of the circumstances of the other person's problem. Oh well, those days are gone and I am much older now
At any rate, the winner is... Ravi Bhavnani for his excellent reference to the article on periodically pumping messages to keep the dialog alive. My sincere thanks to Ravi!
Doug
Doug Knudson
|
|
|
|
|
This is the code and it does not work. I am getting 5 error messages when compiling. If someone could give me assistance from //#include to //{ I would appreciate it. Do I have the function in the right place? That sort of thing. You guys have really been helpful. I want to be able to print the output of a C++ program after I compile,build, and run it. All I get now is an exe file with no option to print. Could anyone be of assistance to this novice?
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <string>
using std::cout;
using std::cin;
using std::fixed;
using namespace std;
//#include
int main() //(int,char*)
//{
//ofstream printer ("lpt1:");
//Printer <<"test"<<endl;
// return 0;
//}
{
int c;
double fee;
double total;
char a ='y', ans;
string input;
int number;
Thanks
|
|
|
|
|
Was this not answered here?
BRIMID wrote:
This is the code and it does not work. I am getting 5 error messages...
While you failed to indicate what those five error messages were, I would start by putting a closing brace at the end of main() .
BRIMID wrote:
I want to be able to print the output of a C++ program after I compile,build, and run it. All I get now is an exe file with no option to print. Could anyone be of assistance to this novice?
Was this not of any help?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
sorry but, when i read your code, i can't see anything beetween //#include and
, except the main header.
Visibly, you are missing some code, or the <> were understood as HTML tags by IE
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi All,
Does anybody know of any simple tools that can be used to find dead code in Visual C++ code? What I am interested in specificaly is something that could identify things like:
Member variables declared in a class that are never referenced.
Member functions declared in a class that are never referenced, ie could safely be commented outwith no effect on code.
Classes that are defined and implemented, but not referenced in a solution, which could be safely removed.
Old code has a tendency to grow by accretion, and it would be good to be able to have some tool that would help to trim dead code.
Thanks
|
|
|
|
|
I'm thinking that lint will do most, if not all, of what you require. It's been over a decade since I've used it but I remember it being a powerful ally.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
My first thought, also. I used to do just this with PC-Lint, and I think they have been keeping up with C++ and handling larger projects.
Check here: http://www.gimpel.com
I also use manual text file searching... slow but it gets the job done.
|
|
|
|
|
////////////////////////////////////////////////////////////////
code segments:
static int gnWSNotifyMsg = RegisterWindowMessage(__FILE__ ":wsnotify");
ON_REGISTERED_MESSAGE(gnWSNotifyMsg, OnWinsockNotify)
This is called when an event occurs:
OnWinsockNotify(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////
I am looking at some code that gives notification when a network event occurs on a socket.
1. Can someone tell me what __FILE__ ":wsnotify" means in the code above?
2. When I get an event, a user defined function "OnWinsockNotify()" is called. What are WPARAM, LPARAM lParam in the argument list above?
Thanks.
Jerry
|
|
|
|
|
1/
__FILE__ is a macro defined by the compiler. It
will be equal to "myfile.cpp" for example.
So the command could be:
static int gnWSNotifyMsg = RegisterWindowMessage("myfile.cpp" ":wsnotify");
which is equivalent to:
static int gnWSNotifyMsg = RegisterWindowMessage("myfile.cpp :wsnotify");
which makes the string that little more likely to be unique.
2/ As it is a message defined by you, YOU tell other people / yourself what you want WPARAM & LPARAM to be!
Oftern wParam would be flags of some sort, and lParam would actually be a pointer to something. Or you may have wParam be a thread ID, lParam not used, and the message is posted when a worker thread is finished.
etc, etc.
As you know *why* a message was registered, you'll know what you want it to do!
Iain.
|
|
|
|
|
XP and 2K can display different images inside an exe icon,
do you know sizes of these images?
i.e. win 98 can display icon images in sizes of 16x16 and 32x32 pixels.
does XP and 2K support icon image of 64x64 pixels or more?
thx
includeh10
|
|
|
|