|
Can I have any examples ??
Also, I want to ask how can I open two dialog box at the same time when running an application??
thx very much!!
|
|
|
|
|
|
I want to ask regarding the masking in Visual C++ . In my project i need to control 9 devices at the same time by using one parallel port interfacing,which is 3 fan, 3lamp, and 3 switch. So, how should i do,should i use the masking way and what is its source code.
|
|
|
|
|
Tan Sen Nee wrote:
...and what is its source code.
Its source code is whatever you write.
I'll assume you have a way of setting the parallel port to a word (16 bits) of your choice.
struct
{
WORD wLamp1 : 1;
WORD wLamp2 : 1;
WORD wLamp3 : 1;
WORD wGap : 4;
WORD wFan1 : 1;
etc...
} MyHardware;
MyHardware.wLamp2 = 1;
SetParallelPortFunctionOfSomeKind ((WORD *)&MyHardware);
MyHardware.wLamp2 = 0;
SetParallelPortFunctionOfSomeKind ((WORD *)&MyHardware);
Search your C(++) manual for "bit fields".
Iain.
|
|
|
|
|
hello,
I want to do pci detection in an MFC application. I wrote inline assembly codes to do it.
...
int a=0;
int c=0;
__asm
{
mov ax, 0xB101;
int 0x1A;
mov a,eax;
mov c, ecx;
}
...
The program was compiled. while running, when this function is called, it gives an error message as "The instruction at '0x....' referenced memory at '0xffffffff'. The memory could not be 'read'." and closes.
I could not find any documentation for pci bios functions on vc++. I need to do it in vc++; not in dos, or dos under windows.
It's not only the detection, but also I want to read from the pci config. space later on.
i would be very happy to get some help.
thanks...
|
|
|
|
|
caykahve wrote:
I want to do pci detection in an MFC application. I wrote inline assembly codes to do it.
In short, you can't.
MFC apps run in user mode. This is a lower privilege mode, and the OS stops you from accessing
hardware, other programs memory, etc.
You will need to write a device driver to do your hardware level work, and communicate with
it from your MFC app.
Neither of these steps are going to fit in a quick answer...
Iain.
|
|
|
|
|
How can i redarw controls(with changed co ordinates) in a MFC Application, once i have detected that resolution has changed??
|
|
|
|
|
Call the RedrawWindow function on the top level window with atleast the parameters RDW_INVALIDATE and RDW_ALLCHILDREN. It will step through all child windows itself and make sure every child window gets redrawn. Then again, if the resolution has changed don't all windows get a WM_PAINT message automatically?
|
|
|
|
|
thanx Luuk,
But it doesn't seem to work. Can u elaborate on it by an example.
|
|
|
|
|
Sure, it's quite simple:
LRESULT CMyFrameWnd::OnDisplayChange(WPARAM wParam, LPARAM lParam)
{
RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN | RDW_UPDATENOW);
return CFrameWnd::OnDisplayChange(wParam, lParam);
}
This should do the trick, if it doesn't then I suppose something else is going on.
|
|
|
|
|
Hi!
I have a problem with saving packets to a file. A packet loss occur at time XXYY. Then I will name open a file name it to XXYY, store some packets, and then close the file. Next time a packet is losses I will open a new file with the name as time HHMM. But it will not work. It cannot open the file.
Does anyone know how to do it???
Im store the time in a char buffer, and then I copy it into char Filename[20].
My code:
void WriteToFile()
{
strcpy(Filename, time[line])
ofstream outFile;
outFile.open(Filename, ios::out);
if(!outFile){cout << "cant open file"<
|
|
|
|
|
Add some breakpoints. Determine why the program cannot create the file.
Kuphryn
|
|
|
|
|
Ouuuuch! Trying to check statically declared ofstream for errors by if (!outfile) ?????
Use if (outfile.fail()) { ... } )
Robert-Antonio
"I launched Norton Commander and saw, drive C: on the left,
drive C: on the right...Damn, why I need two drives C:??? So I formatted one..."
|
|
|
|
|
Hi
Is it possible to add toolbar and statusbar to an dialogbased application?
WBR
Edi
|
|
|
|
|
|
Hi everyone,
I have class A in DLL with virtual function in it, like this...
<br />
class __declspec(dllexport) A {<br />
public:<br />
vitual void Foo() { some code; };<br />
}<br />
And there is derived class B in the same DLL...
<br />
class __declspec(dllexport) B : public A {<br />
public:<br />
vitual void Foo() { some code; };<br />
}<br />
Now, when I compile it, everything's ok. But I also have a console app where I create instances of class B from DLL. Of course I link .lib file with it. But when I try to compile this app I have an error from linker.
error LNK2001: unresolved external symbol "public: virtual void __thiscall B::Foo(void)"
Does anybody have any ideas how to solve this matter?
P.S. When I check EXPORTS from my DLL with dumpbin.exe, I can see both methods there. So, ?FooA@A@@ and ?FooA@B@@ are there. But linker's looking for ?Foo@B@@, without "A" at the end of the method name and obviously can't find it.
Any idea what's wrong?
Thanks in advance,
va'Lery
|
|
|
|
|
This is, I admit, a guess.
When included by the application, is it marked __declspec(dllimport) ?
You should normally write your header as follows:
#ifdef BUILDING_DLL
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif // def BUILDING_DLL
class MYDLL_API A { };
class MYDLL_API B : public A { }; and define BUILDING_DLL in the DLL project.
I'm not sure how well __declspec(dllexport) interacts with in-line member function definitions.
|
|
|
|
|
Thanks Mike,
I surely use mechanics that you described, so in my app I have __declspec(dllimport).
Concerning inline function, if I remove "virtual" when everything's fine. But that's not what I need. I have to use virtual function there.
va'Lery
|
|
|
|
|
hi.
Plz tell me how can i place a GIF file on a Dialog ,, and in a rich edit control
thanx
|
|
|
|
|
Hi!
GIF and JPEG files cannot be used in your application because they are copyrighted by their developpers.
As a solution you may put a webbrowser control and show the gif file in it ( you put it in a html file and it is done).
I hope this helps!
Well... I am a beginner ...
|
|
|
|
|
read about GDI+
it supports various graphics file formats, and is quite easy to use (for simple things
here's a quick plan:
1. initialize gdi+
2. initialize an Image from file (or stream)
3. initialize a Graphics object
4. display the Image through the Graphics::DrawImage()
5. deinit gdi+
well, sort of
there are many usefull examples here on codeproject
|
|
|
|
|
I m building voice conversation application .
now i want to send SoundBuffer (of Directx) via Socket to my server.
how can i send it .. will it be lose its data .
plz help mee
thanx
|
|
|
|
|
Hello, I have a MFC application that is running (dialog based with icon in task bar).
I want to terminate this apllication so I post the WM_CLOSE message to the handle of the window.... But that doesn't work !!
If I post the WM_QUIT message, that works fine
Why ???
|
|
|
|
|
One possibility - if the MFC dialog overrides OnClose() and doesn't call the base class's OnClose(), the dialog will not be closed.
|
|
|
|
|
Huummm yes ok !! That's it.
I have a button called Close on the dialog that just hide the window. I added a handler for this command: OnClose() and this function doesn't call the base class OnClose....
Thanks for reply !!
|
|
|
|