|
|
HakunaMatada wrote: Can anyone give me pointers on creating an Application without any UI?
If you hand me one of those beers I'll give you a pointer
The very simplest way would be to not show your app's main window.
Thanks for the beer
Mark
|
|
|
|
|
Mark Salsbery wrote: The very simplest way would be to not show your app's main window.
I know we can just hide the main Window but I was looking at a more elegant solution.
Mark Salsbery wrote: Thanks for the beer
You are welcome.
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
It’s rather simple to write an unmanaged C++ application that crashes when it performs a callback. It’s impossible to write a managed application that does the same, thanks to delegates. - Jeff Prosise
|
|
|
|
|
HakunaMatada wrote: but I was looking at a more elegant solution.
Console app with hidden console window.
A service application (but has to be run from the service manager).
What if you make a Win32 app and never create a window?
|
|
|
|
|
Mark Salsbery wrote: What if you make a Win32 app and never create a window?
I did try this and it seems to work. I created a message loop but didn't create any window. Would this affect the application in any way?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
It’s rather simple to write an unmanaged C++ application that crashes when it performs a callback. It’s impossible to write a managed application that does the same, thanks to delegates. - Jeff Prosise
|
|
|
|
|
I would think if it runs it's fine
As long as there's a way to terminate the process it shouldn't matter.
Windows service applications run just fine with absolutely NO UI. The only difference is the
added entry points so the SCM can control them.
You may not even need a message loop.
Mark
|
|
|
|
|
Have you tried to do this from a Win32 based console app?
Chris Meech
I am Canadian. [heard in a local bar]
I agree with you that my argument is useless. [Red Stateler]
Hey, I am part of a special bread, we are called smart people [Captain See Sharp]
The zen of the soapbox is hard to attain...[Jörgen Sigvardsson]
I wish I could remember what it was like to only have a short term memory.[David Kentley]
|
|
|
|
|
HakunaMatada wrote: Can anyone give me pointers on creating an Application without any UI?
I think that's not allowed on Windows.
|
|
|
|
|
how to ping remote system running on Windows 2000 using WMI
is there any patch for windows 2000 to ping remote system using win32_pingstatus class
thanks
abhi
|
|
|
|
|
|
I am trying to write an app that will play a movie and allow me to draw on top of it. I have gotten to the point where I can play the movie and using CCLientDC I can draw lines and shapes on the window while the movie is paused. My problem is that as soon as I start the play back of the movie again everything that I jsut drew dissappears. I tried saving all the info about the lines and then in the OnDraw function redrawing them everytime the movie needs to be refreshed but that doesn't seem to work. Does anyone have any suggestions on how to do this?
My environment is VC++ 6.0
thanks,
Mike
|
|
|
|
|
barrem wrote: allow me to draw on top of it
You can't use the same window since the movie playing is drawin in that one. You would have to create another window on top of (Z order) the one the movie is drawing to and draw into the new window.
led mike
|
|
|
|
|
An alternative is, if you have control over the video renderer (you have access to each frame
of video before it gets blted to the window) then you can draw stored shapes offscreen on the
video frame and then blt it. This makes it nicely flicker-free as well.
|
|
|
|
|
Does anyone know why the syntax for exporting constants in a DLL is different from exporting variables or functions?
Take the following code snippet for instance:
extern "C"
{
extern const IID IID_IX =
{0x32bb8320, 0xb41b, 0x11cf, {0xa6, 0xbb, 0x00, 0x80, 0xc7, 0xb2, 0xd6, 0x82}};
}
Why do the extern statements need to be nested?
|
|
|
|
|
extern "C" is not exporting it is a compiler directive that eliminates name decoration.
led mike
|
|
|
|
|
Hi all,
I want to input joystick to my code,which is very simple smile.gif.I searched the net but find out that people use DirectInput , etc... but i want a very simple application, for example like when you pull right, a variable in the code changes from 0 to 10,whne you pull left another variable changes from 2 to 8, etc... I use VC++ v6.0, no .NET,no C# please. here i send a sample code I wrote in which i wanna input joystick for sometry. thank you everyone.
[code]
#include <time.h>
#include <iostream>
using namespace std;
void wait ( double seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLK_TCK ;
while (clock() < endwait) {}
}
int main()
{
double t;
double delt;
double delf;
double function;
cout<< "Derivative of the function : "<<endl;
cin>>delf ;
cout<< "Time deviation : "<<endl;
cin>>delt;
t=0.0;
function=0.0;
do {
function = function+ delf*delt ;
// here i want to add joystick reading here
// joy1= ....???
//joy2= .....???
// like : when i move left,it reads 5 for joy1, and when i move right it reads 3 for joy2, etc...
// moreover,it eould be superb if also i can read the value as how much i move joystick,
//for example, when i move it from center to left end,joy1 value increases from 0 to 8.
// PLEASE HELP //
wait (delt);
t=t+delt;
cout<<" Function is "<
|
|
|
|
|
I am also looking for infomation on how to involve a joystick with my VC++/MFC application.. Using VS2005
I think we need to use the DirectX SDK with VC++ for joystick.. is this correct?
|
|
|
|
|
Check out DirectInput in the DirectX SDK
|
|
|
|
|
|
Hello,
I came across a strange problem. I have a dll which creates an instance of a class. This class inherits from a template singleton.
The singleton template:
template <class T>
class CSingleton
{
public:
static T* GetInstance()
{
if (!m_pInstance)
m_pInstance = new T;
return m_pInstance;
}
void Destroy()
{
if (m_pInstance)
delete m_pInstance;
m_pInstance = NULL;
}
protected:
CSingleton() { }
virtual ~CSingleton() { }
private:
static T* m_pInstance;
};
template <class T> T* CSingleton<T>::m_pInstance = NULL;
The class is a simple empty class:
class CMyClass : public CSingleton<CMyClass>
{
friend CSingleton<CMyClass>;
protected:
CMyClass();
~CMyClass();
};
And then I have an exported function that creates and return the instance of this class:
#ifdef DLL_EXPORTS
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif // DLL_EXPORT
DLL_API CMyClass* CreateClass();
(the function simply call GetInstance of CMyClass and returns the pointer)
When I call this function from the code of my executable, it returns well a pointer to the instance but the strange thing is that the static m_pInstance member of CSingleton is NULL.
I used the debugger and this member is correct inside the CreateClass function but as soon as I come back in the code of the executable, then this member is NULL.
It means that if I try to call Destroy, the memory won't be released. Worse, if I call GetInstance, I will certainly have an unexpected behavior (the instance will be created a second time)
It has probably something to do with the fact that this member is static. But I don't understand clearly what's happening there. Is there a workaround ?
Thank you.
|
|
|
|
|
This is very odd. I am using VS03 and this seems to work as expected.
I added a trace statement to GetInstance :
static T* GetInstance()
{
if( ! m_pInstance )
{
m_pInstance = new T;
}
TRACE( "CSingleton::GetInstance() returning %p\n", m_pInstance );
return m_pInstance;
}
and test it like this :
CMyClass * p = NULL;
p = CreateMyClass();
if( p )
{
TRACE( "CMyClass instance 1 is %p\n", p );
}
p = CreateMyClass();
if( p )
{
TRACE( "CMyClass instance 2 is %p\n", p );
}
this is the output :
CSingleton::GetInstance() returning 01242848
CMyClass instance 1 is 01242848
CSingleton::GetInstance() returning 01242848
CMyClass instance 2 is 01242848
|
|
|
|
|
Hello Rick, thanks for your answer.
Yes, I tested this and it works also: I only have one instance (the pointer returned the second time is the same). I was wrong when I discussed about the second instance in my previous mail.
But what doesn't work is the Destroy method: if I call this method (which isn't static), then the m_pInstance in the singleton is NULL (when GetInstance was called previously). Thus, the memory is not released.
EDIT: also when I check this value with my debugger, the m_pInstance is valid during the CreateClass function but as soon as I come back in the code of my executable, this value is NULL.
EDIT2: so it seems that this pointer is only "visible" from inside the dll. If I call a static function (from the singleton class), then the pointer will be visible from within this function. If I call a non-static function (also from the singleton class), then the pointer is NULL. In the code of the executable, this pointer is always NULL.
I'm a little bit lost here
-- modified at 14:19 Friday 1st December, 2006
|
|
|
|
|
|
Hello,
Thanks for your answer. Yes, I think it has something to do with that but the problem is that it is a template, so I don't have a cpp file
Don't know how I will solve this issue...
|
|
|
|
|
Destroy() should be static as it is the antithesis of getInstance().
led mike
|
|
|
|