|
no, there's no single file to include, and if you're not using any classes that are in std, you don't need to use the namespace.
but, if you want to have "using namespace std;" for some other reason and just want to get rid of that error message, try :
#include < vector >
Cleek | Losinger Designs | ClickPic | ThumbNailer
|
|
|
|
|
thanks, I had already gotten it to do that by including <iostream>. I only wanted to use it because I thought it was possibly the cause of another error, but it wasn't, so I'll keep working!!;P
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hello,
I want to insert two files in a MFC workspace. Two files are readText.h and readText.cpp.
the header file is:
#ifndef _READTEXT_H_
#define _READTEXT_H_
#include "fstream.h"
void readText(char *filename, int *spalte, int *zeile);
#endif
and at the begin of the readText.cpp I write #include "readtext.h
but there is a compile error C1010. how should I write the header file?
thanks in advance
dada
|
|
|
|
|
Your project uses pre-compiled headers, your .cpp file needs to #include "stdafx.h" before it includes anything else.
|
|
|
|
|
it works! thank you very much!;)
|
|
|
|
|
Hi,
I'm having trouble using WaitForSingleObject for the handle used in ShellExecute(). The mutex returned always has 0xffffffff, i.e. WAIT_FAILED.
Why dont I receive any of these:
WAIT_OBJECT_O, WAIT_ABANDONED or WAIT_TIMEOUT.
It seems that the handle from ShellExecute cannot be used with WaitForSingleObject. If thats the case, then what should I use to wait for the ShellExecute process to complete?
Note: ShellExecute process executes a batch file which has several commands to run on command prompt. This proocess takes several seconds to complete, which could vary though.
Any help or comments are appreciated.
Thanks,
- Nirav
===========================================
x = ShellExecute(handl, "open", "foo.bat", NULL, NULL, SW_HIDE);
mutex = WaitForSingleObject(handl,INFINITE);
do {
mutex = WaitForSingleObject(handl,INFINITE);
} while(mutex == WAIT_OBJECT_0);
if(mutex != WAIT_OBJECT_0)
return E_FAIL;
BOOL status = ReleaseMutex(handl);
if (status == 0) {
DWORD LastErr = GetLastError();
}
===========================================
|
|
|
|
|
Your second wait is returning the INVALID_HANDLE. If you use the INFINITE flag, then the second wait is unnecessary and invalid.
onwards and upwards...
|
|
|
|
|
OK.
If I remove the first wait, it still returns the same mutex (0xffffffff) from the second wait.
Any clue?
Thanks again.
|
|
|
|
|
The first parameter to ShellExecute() and WaitForSingleObject() are not the same thing. The former is a window handle, while the latter is a handle to an object. What you want is something like:
PROCESS_INFORMATION pi = {0};
CreateProcess(..., &pi);
WaitForSingleObject(pi.hProcess, ...);
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I'm not sure if I can execute a batch file on command line using CreateProcess.
Note that the batch file include several different commands (compile and link) which needs to execute on the "same" command line window.
CreateProcess execute an application with one command only. I'm not sure if it can execute a batch file.
If I execute the following code, I get exception handling error on CreateProcess() line.
===============================================
PROCESS_INFORMATION pi;
if(CreateProcess("foo.bat", NULL, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, NULL, &pi) == FALSE) {
return S_FALSE;
}
do {
mutex = WaitForSingleObject(pi.hProcess,INFINITE);
} while(mutex == WAIT_OBJECT_0);
|
|
|
|
|
ndalal wrote:
I'm not sure if it can execute a batch file.
Yes, it can be used with .bat files.
I do not think NULL is a valid option for the ninth parameter.
The do/while loop seems unnecessary as WaitForSingleObject() will do its own waiting without using any processor time. As you have it written, WaitForSingleObject() will wait indefinitely for the object's state to become signaled, but will then loop infinitely as the state will remain signaled.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
|
I am using a dialog based application.
The application will generate a report after doing a lot of testing.
I want the report to be printed whenever the user presses one button from the dialog box.
Can anyone help me.
Joesam
|
|
|
|
|
See this article[^] by Richard Stringer. Should have everything you ever need in printing from MFC programs.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
This article of mine MFC CDialog print/preview extension[^] will do exactly what you need.
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
Hey guys,
here is the problem:
I have to keep an static array of pointers of type base class , and I should be able to assign each of these pointers to any of the derived class..
here is the code...
class Base
{
public:
static Base* basePtr[10];
}
class derived1 : public Base
{ }
class derived2 : public Base
{}
now in my main.cpp I want to be able to create objects of derived1 or derived2 and assign the basePtr to point to them....
how do I do that???
.....
...
derived1 d1
Base::basePtr[1] = &d1 // I tried this approach, the problem is...does this mean I have to have 10 different classes of d1 or d2 and then assign each of their references to the basePtr ??? Is there way to do this dynamically so that I do some thing like the following
Base::basePtr[1] = new derived1;
Pls help..
thanks
|
|
|
|
|
Without arguing about the design of these classes, grin, you can do:
<br />
for (int i=0; i<5; i++)<br />
{<br />
Base::basePtr[i] = new derived1;<br />
Base::basePtr[5+i] = new derived2;<br />
}<br />
what could be nicer would be to have the constructor of Base store the pointers itself.
<br />
Base::Base()<br />
{<br />
basePtr[numObjects++] = this;<br />
}<br />
You would have to add a static 'numObjects' counter for this to work, or...
<br />
Base::Base(int pos)<br />
{<br />
basePtr[pos] = this;<br />
}<br />
As long as you don't create 'Base' objects but only derived objects, you can just go and do this :
<br />
for (int i=0; i<5; i++)<br />
{<br />
new derived1;<br />
new derived2;<br />
<br /> OR:
<br />
new derived1[i];<br />
ned derived2[5+i];<br />
}<br />
|
|
|
|
|
oh one important detail I left out is that
my base class is abstract ....
so there will be instantiation of this class inside the main program.
I tried ur method above to have new objects created dynamically and store thier pointer to the array pointer but it doenst seem to be working
I tried
Base::basePtr[1] = new derived1;
this would not work ! I get a link , unresolved external for static Base::basePtr ...etc etc..
do I have to initialize the abstract class that contains the static array somewhere in the main code ??? how do I do that? or is it even possible?
Thanks
|
|
|
|
|
This happens because you don't declare the array itself.
You 'declared' it in the array, but that was only a 'state of purpose', you need to decalre the variable itself.
so, take your .cpp file, and somewhere in the begining write :
Base* Base::basePtr[10];
then it will link.
p.s. - if your base-class is abstract, then it will never be instantiated 'by itself'.
|
|
|
|
|
hi gang
is there anyone tried to add protocol such as netbuei to available installed protocol in win 2k ?
if yes ,give me a clue .
thnx in advance .
|
|
|
|
|
Hello again !
I post this message again for adding more detailes for my problem.
It seems that I've been missunderstood! I want to query directly the device.
The two methods that you recomended are for reading from registry. This information are available only if a driver is already installed. I want to comunicate to he device even if I don't have a driver instaled.
Thank you again
///////////////////////////////////////
// this is the original message posted
////////////////////////////////////
Hello !
My name is Cristi and I have a big big problem.
I want to get the plug and play informations from a printer connected via parallel port (or usb). Using DeviceIoControl with IOCTL__PAR_QUERY_DEVICE_ID is great in Windows 2000 or XP, but on Windows 95,98 and Me it doesn't work at all. I tried defining myself this IOCTLs with CTL_CODE macro but in vain.
I need to query directly the device and not the driver.
Please, if anyone knows, tell me how can I obtain the plug and play information on an operating system like Windows 95, 98 or ME
You can write me at funnycreeps@go.ro
Thank you !
|
|
|
|
|
I have an application that allows the user to make their own query by selecting fields and then viewing the results. As anyone who's seen my frustrated questions lately would know I've made a DLL to export these results to a .DBF file (the query is done on a MySQL database). This is my question: Should I actually export what they see in their results, or should I export the newest results? The dilemma occurs because the user may make a query with 100 records returned. However this being a large system, if they keep that screen up for a few seconds, something different might be input into the system which might make their query now return 101 records. Either way is easy to implement, I'm just looking for advice on which strategy I should use. Any help is greatly appreciated. Thanks!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
bdiamond wrote:
Should I actually export what they see in their results, or should I export the newest results?
You could always make it an option. If the user is satisfied with the results that were returned, they might not want to bother with a requery.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I also thought about that and was wondering. thanks!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Perhaps you can give more background on what exactly is going to be done with these results...
What you're describing is a classic question of :
Is the user suppose to get a snapshot, or is he suppose to be able to view up-to-date resutls all the time.
The first one makes it easy for you, get the results, save them to disk, and you're done.
It's hard for me to understnad how you want to achive 'always up-to-date' with saving data to a file anyways ?
cheers
|
|
|
|