|
Padmanabha_M wrote: How can we validate the edit box such that it accepts only one zero in the first place.
By reading here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I want to start a simple UI application, actually a message box through a windows service I do the following.
<br />
void OnStart(String* args[])<br />
{<br />
Threading::ThreadStart* threadStart = <br />
new Threading::ThreadStart(this, DoProcess);<br />
servicethread = new Threading::Thread(threadStart);<br />
servicethread->Start();<br />
}<br />
<br />
void DoProcess()<br />
{<br />
m_iSleepTime = 10000;
m_bRunning = true;<br />
<br />
while(m_bRunning)<br />
{<br />
(void)system("UI.exe");<br />
Threading::Thread::Sleep(m_iSleepTime);<br />
}<br />
}<br />
But it doesn't work. Can someone looking into it? I cannot figure out what the error is. Same way I can execute the UI in console application, but not here.
Thanks a lot
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Some documentation which may assist you:
Interactive Services[^]
If you simply want to display a message to the logged on user you can simply call the MessageBox Function[^] and pass the uType of MB_SERVICE_NOTIFICATION. Calling this from your service will cause a messagebox to appear on the active desktop.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: If you simply want to display a message to the logged on user you can simply call the MessageBox Function[^] and pass the uType of MB_SERVICE_NOTIFICATION. Calling this from your service will cause a messagebox to appear on the active desktop.
I tried this, include the relevant header file as well. Found an error, MB_SERVICE_NOTIFICATION is not defined ...
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: Found an error, MB_SERVICE_NOTIFICATION is not defined ...
Did you look in winuser.h to find out the cause (hint: what is the value of _WIN32_WINNT )?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Is anything wrong with the way I've start/execute the external exe?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: Is anything wrong with the way I've start/execute the external exe?
There are many things wrong. Windows is a multi-desktop and multi-user operating system and your service cannot just start an application. There is much more to it than that. The link below is a good place to start.
Starting an Interactive Client Process in C++[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Hi All,
I've install a windows installation in C++, using installutil command. I got the following error at installation. Anyone of you have any idea what that means is?
Exception occurred while initializing and installation.
System.IO.FileLoadException: Unverifiable image 'MyService.exe' cannot be run...
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: I've install a windows installation in C++, using installutil command.
The Installer Tool[^] is used for installing services created with .NET and uses reflection to 'verify' the service.
Note that you cannot deploy a Windows service created using C++ with Installutil.exe. Installutil.exe cannot recognize the embedded native code that is produced by the C++ compiler. If you attempt to deploy a C++ Windows service with Installutil.exe, an exception such as BadImageFormatException will be thrown.
If you have written the service in Managed C++ try installing your service with MyService.exe -Install
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks a lot. I've read a bit about the installation on services, and I found the same solution as here. Thanks again.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Hi,
Don't know why this is
buf for some reason the the first 4 bytes of the destination buffer gets overlayed with some
seems like address upon return from the CallBack routine
|
|
|
|
|
how about posting the smallest amount of code that illustrates the issue - then we might actually be able to help - else we just have to take your word for it and most of us will be thinking "he's doing something goofy"
'g'
|
|
|
|
|
Here is a storage Display when sitting on the break point at the return of the CallBack function
e.g return 0;
0x00167F84 00 00 00 00 58 58 58 58 58 58 20 20 37 46 46 46 46 ....XXXXXX 7FFFF
0x00167F95 30 30 30 20 20 37 46 46 46 46 30 30 30 20 20 20 20 000 7FFFF000
0x00167FA6 20 20 37 46 46 46 46 30 30 30 20 20 37 46 46 46 46 7FFFF000 7FFFF
0x00167FB7 30 30 30 20 20 20 20 20 20 00 00 00 00 00 00 00 00 000 ........
0x00167FC8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .................
0x00167FD9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .................
0x00167FEA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .................
0x00167FFB 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
As you can see address 167f84 is nulls
Upon return from the editstream
0x00167F84 78 01 15 00 58 58 58 58 58 58 20 20 37 46 46 46 46 x...XXXXXX 7FFFF
0x00167F95 30 30 30 20 20 37 46 46 46 46 30 30 30 20 20 20 20 000 7FFFF000
0x00167FA6 20 20 37 46 46 46 46 30 30 30 20 20 37 46 46 46 46 7FFFF000 7FFFF
0x00167FB7 30 30 30 20 20 20 20 20 20 00 00 00 00 00 00 00 00 000 ........
0x00167FC8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .................
0x00167FD9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .................
0x00167FEA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .................
0x00167FFB 00 0
As you can see there is some sort of adress there
this break point is right after this statement
Myricheditctrlptr->StreamIn(SF_RTF, es);
thankx
|
|
|
|
|
What symbol or code does the address 0x00167F84 correspond to?
Does it represent the number of bytes actually read?
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
static DWORD CALLBACK readbuff(
DWORD dwCookie, // (in) pointer to the string
LPBYTE pbBuff, // (in) pointer to the destination buffer <============
LONG cb, // (in) size in bytes of the destination buffer
LONG FAR *pcb // (out) number of bytes transfered
)
"pbBuff" the destination buffer .....
|
|
|
|
|
one obvious question I missed, are you going from the rich-edit-control to a file (stream out/output) or reading a file into the rich-edit-control (stream in/input) - the
ForNow wrote: Myricheditctrlptr->StreamIn(SF_RTF, es);
tends to suggest you're loading the rich-edit-control from a file, but it pays to be sure..
so does it not work the way this link suggests >> http://msdn.microsoft.com/en-us/library/h2hkhzhe(VS.80).aspx[^]
'g'
|
|
|
|
|
THANK YOU !!!!!!!!!!!!!!!!!!!!!! changed from SF_RTF to SF_TEXT
came back ok
|
|
|
|
|
Hey, i hope you can help me with my question:
I started learning working with DirectX, in the start i saw a codeexample for how open an empty window (without chosing winn app at the start of Visual Studio)
but for some reson, the code makes me problems, hope you can say to me why
code
#include <windows.h>
HINSTANCE hInst;
HWND wndHandle;
bool initWindow( HINSTANCE hInstance );
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow )
{
if ( !initWindow( hInstance ) )
{
return false;
}
MSG msg;
ZeroMemory( &msg, sizeof( msg ) );
while( msg.message!=WM_QUIT )
{
while (GetMessage(&msg, wndHandle, 0, 0) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
return (int) msg.wParam;
}
bool initWindow( HINSTANCE hInstance )
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = "DirectXExample";
wcex.hIconSm = 0;
RegisterClassEx( &wcex );
wndHandle = CreateWindow(
"DirectXExample",
"DirectXExample",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
640,
480,
NULL,
NULL,
hInstance,
NULL);
if (!wndHandle)
{
return false;
}
ShowWindow(wndHandle, SW_SHOW);
UpdateWindow(wndHandle);
return true;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
Errors:
Error 1 error C2731: 'WinMain' : function cannot be overloaded c:\users\יהב\documents\visual studio 2008\projects\learningdirectx\learningdirectx\winmain.cpp 11 LearningDirectX
Error 2 error C2065: '“DirectXExample”' : undeclared identifier c:\users\יהב\documents\visual studio 2008\projects\learningdirectx\learningdirectx\winmain.cpp 56 LearningDirectX
Error 3 error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [15]' to 'LPCWSTR' c:\users\יהב\documents\visual studio 2008\projects\learningdirectx\learningdirectx\winmain.cpp 71 LearningDirectX
Sorry to ask but please try to help me (I couldnt solve it for hours before i came here)
Thanks and good day, Yahav.
Gindi Bar Yahav - Web & Software defeloper.
|
|
|
|
|
not sure right now about the winmain part it looks correct.
The DirectXExample has to be a registered class name when you pass it to CreateWindow, it's not just some text you specify.
from MSDN:
lpClassName:
Pointer to a null-terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx function.<br> The atom must be in the low-order word of lpClassName; the high-order word must be zero.<br> If lpClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx,<br> provided that the module that registers the class is also the module that creates the window. <br>The class name can also be any of the predefined system class names. <br>For a list of system class names, see the Remarks section.
|
|
|
|
|
Gindi Bar Yahav wrote: Error 2 error C2065: '“DirectXExample”' : undeclared identifier c:\users\יהב\documents\visual studio 2008\projects\learningdirectx\learningdirectx\winmain.cpp 56 LearningDirectX
It looks like you're using some abnormal quotation marks around your string constant; make sure you're using regular quotes and not smart quotes. Aside from that, make sure you're not compiling the program as UNICODE (unless you want to change your WinMain function to _tWinMain and wrap all your string constants with the TEXT(...) macro.)
|
|
|
|
|
Thanks!! you solved me the problem.
i clicked properties and the "charset" was unicode, so i changed to multy-byte charcters (its ok?) but now its compiling me with no error, now i can go back to learn, thanks.
Gindi Bar Yahav - Web & Software defeloper.
|
|
|
|
|
|
|
|