|
Does Win32 console based application supports WinMain and WinProc
phani
-- modified at 1:27 Tuesday 3rd January, 2006
|
|
|
|
|
AFAIK, No.
The presence of WinMain and WinProc is what differentiates a Win32 app from a Win32 console app. A Win32 console app has got the main()-func.
Kakan
|
|
|
|
|
What directories are searched for executables when we run a program from Start->Run
dialog box?
It starts MS Word if I just give "winword" in the Run dialog, but my environment variable
PATH does not have the directory "C:\Program Files\Microsoft Office\OFFICE11" which
has winword.exe. Anyone knows how this works?
thanks!
|
|
|
|
|
I think it searches HKEY_CLASSES_ROOT\Applications. This is the registry key for all applications currently installed in the system.
These are the applications that are listed in the open with dialog box.
So this could be it.
Jesus Loves You and Me <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
|
Please help me with my problem.
When I add a MessageBox on OnChange Handler of DateTimePicker and click on the previous and next month scroll button during runtime, the DateTimePicker keeps on changing date. How can I fix this problem?
|
|
|
|
|
Hey Everyone,
Can anyone give me some direction on the best way to detect if a program is starting a setup/installation process for a windows XP machine? I'm assuming that a hook is the best way to intercept the event, but what can I look for? Is there a specific message event or anything that I can look for, a function that always needs to get called when software is being installed?
Any help would be greatly appreciated.
-- Fernando
|
|
|
|
|
hello everyone...
i want to make a security project that gives the ability to control hardware parts...what i mean is that i want to click a button and the computer no longer sees the usb port and/or the device attached to it as if it's not even plugged(not disable or uninstall it's more like total invisibility)...this also contain not only usb, but ide , scsi , raid controllers etc...
this way no one can connect his "parasitic" drive or what ever you want to call it to my pc...
i think there's another aproach for this(beside the hiding) which is the "accesss denying" i don't know if this way can prevent the system from detecting these peripheral parts...
i tried to look for this kind of articles here in codeproject but i wasn't lucky...
i also tried to get something from my vs-msdn documentation and i found under "Platform SDK: Windows Management Instrumentation" Win32_IDEController and Win32_USBController but i found it really hard and confusing...if this is the right place for documentation please someone make a sample program so i can learn from it...
thanx a lot..
|
|
|
|
|
I am having a rather odd problem with my VC++ application when it comes to opening a certain number of documents. Here's a little background. Each document window that opens is a rather complicated formview run by a rather large and complicated object. The serialization alone saves to a file where the size averages about 200k. when I open around 16 documents, in debug the application pretty much stops working, that is I cannot open anything. Clicking on a menu results in nothing. Clicking the toolbar buttons results in nothing. Navigation completely halts. When run in release the application crashes when i open the 16th document. Sometimes I can get 17.
Now I'm thinking this is a memory issue. Certainly sounds like it. My following questions which I hope someone here can answer are:
1) What do you think this is?
2) If it is memory any ideas on solving it?
3) I was thinking perhaps I could have only the object that is currently active in memory, that is, if a person clicks a document window, then activation that object and clear the rest. Problem here is I have no idea how to do this? Opening up a document takes a bit of time: around 3 to 5 seconds to open a document. If I cleared the object I would have to rebuild it which means a 3 to 5 delay each time we switch to a new document window.
4) Any other ideas?
Thanks for the help! I would include source code, but we are talking a HUGE project here. If you need access to the code I can certainly make that happen. Maybe we can narrow the search down to a few c++ files.
Thanks again!
-- modified at 21:05 Monday 2nd January, 2006
|
|
|
|
|
What OS are you using? How much RAM is installed and what is the size of your swap file?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Windows XP: Professional, 3GB of RAM installed. Looks like my swap file is 2GB.
|
|
|
|
|
With that configuration I doubt very much that you are running out of memory. It could be a resources problem. Have you tried running task manager (taskmgr.exe) while your app is running? Keep an eye on CPU and memory usage, and also watch the number of handles, threads, user objects and GDI objects. If one or more of these get way overused that could be your problem.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Interesting.... when I reach the 14th or 15th document opened, the CPU usage goes right to 100%. Now it does this everytime a document opens however it goes down once the doc is fully opened. On the 15th doc it stays at 100% which makes sense why I can't run anything else.
I'll start checking a few things. Do you have any ideas yourself?
Thanks for the help thus far!
|
|
|
|
|
brdavid wrote: On the 15th doc it stays at 100%
brdavid wrote: Do you have any ideas yourself?
Infinite loop.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
okay... I think I'm on to something. Whenever I open a new document the cpu usage peaks, but then doesn't return back to a low number. In fact with each new doc the low value increases until I reach a 100%. Now apparently I can still open up documents but I have a feeling at some point I just hit the limit with whatever is eating up the CPU. I started eliminating logic from the main window, which are tabs with formviews until I got down to one tab. The application now opens up more documents than before and the CPU usage goes back down to under 5 and sometimes zero. So somewhere in my logic for the tabs I have in my main window is causing the problem. I'll give more information when I have it finally nailed.
Thanks for the help.
edit: I have isolated the issue, which makes this even more weird. It has to do with this call:
<br />
pList->CreateEx(WS_EX_CLIENTEDGE, dwStyle, rect, this, IDC_ITEMLISTCONTROL);<br />
Here's the weird part. I set up the application so that I can control the number of times this value is called per document. If called once per document the cpu usage starts to increase the more documents I open until it peaks at 100%. This happens in a custom list ctrl. I have another control that uses the same CreateEx method that subclasses ListCtrl as well and I do not have this issue, so somewhere in this MyListCtrl is the issue which happens to be related to CreateEx().
Weird.
edit: update:
<br />
int CMyListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
CListCtrl::OnCreate(lpCreateStruct);<br />
return -1;<br />
<br />
<br />
}<br /> in turning the OnCreate method into this the CPU usage stays low. When I return 0 like it should the CPU starts to increase upwards the more docs I add. This is becoming a rather difficult problem.
-- modified at 18:45 Friday 6th January, 2006
|
|
|
|
|
I'm trying to access a variable (this->number) from a separate function in a different file. Is there an easy way to do this, like using a global variable or passing the value between functions as one would in C? When I try to access the variable with namespace::functionname::variable, I get the following error message: error C2597: illegal reference to non-static member 'namespace::functionname::variable'. Any help would be greatly appreciated!
|
|
|
|
|
Have you looked up C2597 in MSDN[^]?
[quote]
To access the nonstatic member, you must create an instance of the class and use a member-access operator (. or ->).
[/quote]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Why I can't use the FlashWindowEx() with MFC based dialog...
it gives me that FlashWindowEx is not declared, any way to use it?
thanks in advance...
|
|
|
|
|
FlashWindowEx is declared in WinUser.h. If you open WinUser.h and do a text search for FlashWindowEx you will see that FlashWindowEx is wrapped in a pre-processor conditional statement "#if(WINVER >= 0x0500)". So to use FlashWindowEx you have to #define WINVER 0x0500 at the top of your stdafx.h file.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
the problem is I don't have FlashWindowEx in the WinUser.h
here is what I have
FlashWindow(<br />
HWND hWnd,<br />
#if(WINVER >= 0x0500)<br />
DWORD dwFlags);<br />
#else<br />
BOOL bInvert);<br />
#endif<br />
<br />
#if(WINVER >= 0x0500)<br />
#define FLASHW_STOP 0<br />
#define FLASHW_CAPTION 0x00000001<br />
#define FLASHW_TRAY 0x00000002<br />
#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY)<br />
#define FLASHW_TIMER 0x00000004<br />
#define FLASHW_TIMERNOFG 0x0000000C<br />
#endif /* WINVER >= 0x0500 */
any help with it? thanks....
|
|
|
|
|
You've probobly still got a REALLY old version of the platform SDK, you've got two options, either download[^] the latest version or access the FlashWindowEx function on the fly using GetProcAddress[^].
If you choose the later option, you'll need something like:
typedef struct {
UINT cbSize;
HWND hwnd;
DWORD dwFlags;
UINT uCount;
DWORD dwTimeout;
} FLASHEXINFO, *PFLASHEXINFO;
#define FLASHW_STOP 0
#define FLASHW_CAPTION 0x00000001
#define FLASHW_TRAY 0x00000002
#define FLASHW_ALL (FLASHW_CAPTION | FLASHW_TRAY)
#define FLASHW_TIMER 0x00000004
#define FLASHW_TIMERNOFG 0x0000000C
typedef BOOL (WINAPI *PSFLEX)(PFLASHEXINFO);
static PSFLEX pFlashWindowEx = NULL;
static BOOL initFlash = FALSE;
BOOL uiFlashWindowEx( HWND hWnd, UINT uCount , DWORD dwFlags )
{
if ( ! initFlash )
{
HMODULE hDLL = NULL;
hDLL = LoadLibrary( TEXT( "user32.dll" ) );
if( hDLL )
{
pFlashWindowEx = ( PSFLEX ) GetProcAddress( hDLL, "FlashWindowEx" );
initFlash = TRUE;
}
}
if ( pFlashWindowEx == NULL )
return FALSE;
FLASHEXINFO fwi;
ZeroMemory( & fwi, sizeof( FLASHEXINFO ) );
fwi.cbSize = sizeof( FLASHEXINFO );
fwi.dwFlags = dwFlags;
fwi.hwnd = hWnd;
fwi.uCount = uCount;
fwi.dwTimeout = 0L;
return pFlashWindowEx ( & fwi );
}
Once done, just use uiFlashWindowEx( hWnd, 3, FLASHW_TRAY ); or whatever
Gavin Taylor
w: http://www.gavspace.com
-- modified at 12:37 Tuesday 3rd January, 2006
|
|
|
|
|
thanks alot, I download the last PSDK and linked the vc++ compilter to the new dorectories, and it works great now, thanks alot...
|
|
|
|
|
Hi
I want to show a tooltip on Editbox when my mouse cursor go on it.How can I do it?
I know CTooltipCtrl but I can't use it for editbox.
Agh
-- modified at 2:24 Tuesday 3rd January, 2006
|
|
|
|
|
|
Hi,
I am receiving an error message CXX0030 when trying to a readfile off a com 1 port.
My code is
hCom = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // must be opened with exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // must use OPEN_EXISTING
0, // not overlapped I/O
NULL);
if (hCom == INVALID_HANDLE_VALUE)
{
// Handle the error.
printf ("CreateFile failed with error %d.\n", GetLastError());
return ;
}
// Build on the current configuration, and skip setting the size
// of the input and output buffers with SetupComm.
fSuccess = GetCommState(hCom, &dcb);
if (!fSuccess)
{
// Handle the error.
printf ("GetCommState failed with error %d.\n", GetLastError());
return ;
}
//printCommState();
// Fill in DCB: 57,600 bps, 8 data bits, no parity, and 1 stop bit.
init_settings();
fSuccess = SetCommState(hCom, &dcb);
//printf ("SetCommState...\n");
if (!fSuccess)
{
// Handle the error.
printf ("SetCommState failed with error %d.\n", GetLastError());
return ;
}
fSuccess = GetCommState(hCom, &dcb);
if (!fSuccess)
{
// Handle the error.
printf ("GetCommState failed with error %d.\n", GetLastError());
return ;
}
//printCommState();
//printf ("Serial port %s successfully reconfigured.\n", pcCommPort);
res = GetCommTimeouts(hCom, &get_com_time_outs);
//print_com_timeouts();
res = SetCommTimeouts(hCom, &com_time_outs);
//printf("SetCommTimeouts...\n");
if(!res) printf("SetCommTimeouts failed...\n");
res = GetCommTimeouts(hCom, &get_com_time_outs);
read_bytes=0;
char *reply;
DWORD dwBytesTransferred;
DWORD dwCommModemStatus;
// Specify a set of events to be monitored for the port.
SetCommMask (hCom, EV_RXCHAR | EV_CTS | EV_DSR | EV_RLSD | EV_RING);
while (hCom != INVALID_HANDLE_VALUE)
{
// Wait for an event to occur for the port.
// WaitCommEvent (hCom, &dwCommModemStatus, 0);
// Re-specify the set of events to be monitored for the port.
SetCommMask (hCom, EV_RXCHAR | EV_CTS | EV_DSR | EV_RING);
//if (dwCommModemStatus & EV_RXCHAR)
//{
// Loop for waiting for the data.
do
{
// Read the data from the serial port.
res = ReadFile(hCom, reply, 81, &dwBytesTransferred, 0);//ReadFile (hCom, &Byte, 1, &dwBytesTransferred, 0);
// Display the data read.
if (dwBytesTransferred > 0)
printf (reply);
} while (dwBytesTransferred == 1);
//}
}
void init_settings()
{
dcb.DCBlength = sizeof(DCB);
dcb.BaudRate = CBR_9600; // set the baud rate
dcb.fBinary = TRUE;
dcb.Parity = NOPARITY; // no parity bit
dcb.fOutxCtsFlow = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fDtrControl = DTR_CONTROL_ENABLE; //
dcb.fDsrSensitivity = FALSE;
dcb.fTXContinueOnXoff = FALSE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
dcb.ErrorChar = FALSE;
dcb.fNull = FALSE;
dcb.fRtsControl = RTS_CONTROL_ENABLE;
dcb.fAbortOnError = FALSE;
dcb.fDummy2 = 0;
dcb.wReserved = 0;
dcb.XonLim = 0;
dcb.XoffLim = 0;
dcb.ByteSize = 8;
dcb.StopBits = ONESTOPBIT; // one stop bit
dcb.XonChar = 0;
dcb.XoffChar = 0;
dcb.ErrorChar = 0;
dcb.EofChar = 0;
dcb.EvtChar = 0;
dcb.wReserved1 = 0;
}
Is there something I am missing for reading off the com port?
Thanks
|
|
|
|