|
Hi,
I have a singleton class. I need to access the static getInstance() from another file. The singleton class is defined in another file.
I suppose the static variables and methods have file access.
Thanks,
Venkat SR
|
|
|
|
|
Add the #include diective in the .cpp where u want to create the singleton class.
|
|
|
|
|
#include "singletonFile.h"
Single one ;
if(one == NULL)
one = Single::getInstance();
else
return one;
|
|
|
|
|
Hi,
Thanks for reply,
Class B is singleton. This has static getInstance().
I want to access getInstance() of Class B in Class A. Class B header is included in Class A.
When i do this, it gives linker error LNK2001 unresolved external symbol getInstance().
This error occurs for other non-static functions of Class B, when called from Class A.
Thanks,
Venkat SR
|
|
|
|
|
the format is classB::getInstance.
Note that you have to prefix the class name than :: than getInstance.
If you are doing that, double check your includes. Make sure you haven't accedently #IFed the class out somehow.
|
|
|
|
|
hi everyone,
I have 2 application : app1.exe and app2.exe. how can i launch them at the same time?
if i write:
system("app1.exe");
system("app2.exe");
then, app2.exe can only be executed after app1.exe finishes. is there anyway to resolve this problem?
thanks everyone in advance.
regards,
ken
|
|
|
|
|
How about CreateProcess?
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Hi ken
I've done something you want to do.
My Way : in OnNewDocument you must insert a line like
WinExec("app2.exe", SW_SHOW);
Then you normally start your app1 and the programm itself starts app2
regards
yummi
|
|
|
|
|
i m using VC++ 6 n DirectShow for video capture
i change the debug mode configuration to Release mode
there are warnings as follows
now wt should i do ?
R they have effect on my program or not.
Linking...
LINK : warning LNK4089: all references to "ADVAPI32.dll" discarded by /OPT:REF
LINK : warning LNK4089: all references to "OLEPRO32.DLL" discarded by /OPT:REF
LINK : warning LNK4089: all references to "WINMM.dll" discarded by /OPT:REF
cam.exe - 0 error(s), 3 warning(s)
|
|
|
|
|
No problems there. The compiler has optimised in such a way that it no longer needs those libraries, so it has removed all references to them. Since you weren't using the libraries anyway, it won't make any difference at all. It wouldn't show this in Debug mode because the compiler was probably not optimising your code.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
CDC memDC;
memDC.CreateCompatibleDC(NULL)
I made memory dc with Parameter NULL, which means SYSTEM compatible DC as far as i know..
Because I can't use View's DC in my module that manipulate Bitmap..
And then I made CBitmap..
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&memDC, 200,200);
But What I noticed here is the bitmap that I've just created is 1bit bitmap,
that is white-black bitmap..
I can not understand why..
I saw some source that manipulate bitmap like rotate.. stretch here..
That used same kind of memDC, which was created by the function CreateCompatibleDC with NULL Parameter..
The bitmap that source created was full color bitmap..
What's wrong with my code?
|
|
|
|
|
I've never used CreateCompatibleBitmap. Actually, I don't even use CBitmaps, I use DIBSections via a wrapper class. There are several on CP, but in the meantime, I'm pretty sure that bitmap has a constructor or a general Create call that will do what you want it to.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
johnny,Kim wrote:
But What I noticed here is the bitmap that I've just created is 1bit bitmap,
that is white-black bitmap..
I can not understand why..
This is documented in MSDN. When a memory device context is passed to CreateCompatibleBitmap() , a 1-bit bitmap is always created. To create a colour bitmap, pass in a device context referring to the screen or an actual device.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks you..
I should've checked MSDN.. Sorry about that I was lazy...
|
|
|
|
|
Hello,
I'm using a CWnd derived custom control inside a dialog for drawing. I'd like to know if there's some kind of OnInitDialog (from CDialog) or OnInitialUpdate (CFormView) to do some initialization i cannot do nor in the control constructor, neither in the dialog's OnInitDialog (i'm refering to the dialog that includes the custom control).
Your help will be really appreciated.
Thanks in advance!
|
|
|
|
|
override CWnd::OnCreate or PreCreateWindow in your control
|
|
|
|
|
I am completely new to ASCII programming. My problem is this: I have to send the ASCII command "ENQ" to an amplifier which then sends an analog value back to my compiler.
I have no idea how to send ASCII commands, I am trying to use the MSComm command, but I am not having any luck. If anyone can give any advice on how to 1. send ASCII commands, and 2. be able to read the incoming values from the ASCII commands it would be very helpful to me!!!
Thanks in advance.
Loren
|
|
|
|
|
an ascii command to an amplifier that then sends an analog reply to your compiler?
hmmmmmmmmmmmm....
well i would imagine the amp is plugged into a parallel, serial, usb or scsi port so it can be controlled by the computer ... the replies will be coming back from the amp to the same port you sent them in all liklihood
can u give more details on what equipment u are working with and what u are trying to do?
"there is no spoon" biz stuff about me
|
|
|
|
|
How dare you try and help this person with their icomprehensible request ? No wonder you got voted a 1...
</sarcasm>
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
How do you connect to the amplifier? Because you mentioned MSComm I assume you are using a serial connection - are you sure you have the correct serial settings for the amplifier?
You should be able to download a more capable terminal program that allows you to send ENQ (ASCII 5) commands. The amplifier cannot send you an analog value, it must send a response back through the same serial connection, and in this case will be displayed in your terminal program. Failing that, look through CodeProject for serial communication, and you will have to write a program to send the ENQ, and read the response.
Note: ENQ is nothing special, and there is no 'ASCII programming'. If you look at an ASCII table[^] you will see that ENQ is just the value 5.
|
|
|
|
|
I've never gotten a good answer out of anyone when I have inquired about the proper way to ensure that a file is included only once in a build. I also did not see anything in my thread search so I'll ask and hopefully get a reasonable answer.
In the below subset of code, I though the first set of instructions was to ensure that the header file would be included only once in a build. Then I thought, well what is the pragma once for then? According to the MSDN help, pragma once does the same thing. So when class wizards generate a class header file, why do they insert code that seems to serve duplicate purposes? Any ideas?
#if !defined(AFX_RETRYDLG_H__4A3C71B3_E316_48A5_B38E_7F3E778D47DD__INCLUDED_)
#define AFX_RETRYDLG_H__4A3C71B3_E316_48A5_B38E_7F3E778D47DD__INCLUDED_
//I've already used the previous #ifndef ... #endif to
//ensure the single inclusion of my class declaration.
//Why do I need this #pragma once on top of that?
#if _MSC_VER > 1000
#pragma once
#endif
//of course my class would be declared after the #pragma once statement.
class MyClass
{
MyClass();
~MyClass();
};
#endif // _MSC_VER > 1000
|
|
|
|
|
#pragma once is a microsoft only pragma, and in the example you show, it is useless ( i think ).
I usually remove it from generated code.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
The way i understand it (could be wrong) is that the #ifndef test prevents referential loops when the compiler is recursing through the #include lists for a given module. This is on a per module (cpp file) basis.
Where as the #pragma once is for the entire build session. It likely instructs the compiler to cache the parsed contents of the file so that the second module that needs the file doesn't have to reparse it.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Personally, I'd stay with the #if, etc. directives as this is a more portable way of doing things.
However, the reason for...
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif
...appearing is (IIRC) due to a bug with the developer studio debugger when keeping track of something or another. I tried googling to refresh my memory to no avail though.
Jeremy Falcon
|
|
|
|
|
When you use the #pragma once directive, the compiler will only open and read the file only once. If all you use is the #ifdef...#endif code block, then the compiler will open and read the file every time it is encountered, which is not all that efficient when all of the files contents gets ignored anyway. The only think to remember is that the #pragma once does not work on older compilers, so it is wise to always include both methods in your header file.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|