|
void OnButton1Click()
{
CMenu*t=GetMenu();
t->EnableMenuItem(0,MF_BYPOSITION | MF_DISABLED);
}
when i clicked the button1, the menuitem didn't change to disable. it just change to disable when i put the mouse pointer above it.
So please show me the way to change the menuitem to disable when i press the button1.
thanks...
|
|
|
|
|
You need to use MF_GRAYED instead of MF_DISABLED.
MF_DISABLED - Disables the menu item so that it cannot be selected but does not dim it.
MF_GRAYED - Disables the menu item so that it cannot be selected and dims it.
<font=arial>Weiye Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
A lot of programs that when run in win98 they have the classical interface but in winxp they have another interface (xp style).
But my program when run in winxp, it also have classical interace.
Please show me the way to solve this problem !
thanks...
|
|
|
|
|
|
Hello I'm writing client/server program, I use pipe message to communicate between client and server.
Here is my question.
A server supposes to listen to clients.
So I CreateNamedPipe(), then write the pipe name ""\\\\.\\pipe\\servername" into a text file.
Then called
ConnectNamedPipe(hPipe, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED)
The Client get the string from a text file, then starts to talk to Server by calling CreateFile(), in Server program ConnectNamedPipe() doesn't return until the client get connected (it is true for very first client. I'll explain more later). After the conversation is done, the client closes the pipe, Server call ConnectNamedPipe() again to see whether another client is talking.
server
CreateNamePipe()<br />
while(1)<br />
{<br />
fSuccess = ConnectNamedPipe(hPipe, NULL) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED)if(failed)<br />
if (! fSuccess || cbBytesRead == 0) <br />
break;<br />
do conversation,<br />
}<br />
FlushFileBuffers(hPipe); <br />
DisconnectNamedPipe(hPipe); <br />
CloseHandle(hPipe); <br />
When the server call ConnectNamedPipe second time, fSuccess is always failed and close the pipe. How can Server keeps the pipe open until one of the client said, finished all the job.
When the Server is executing ConnectNamePipe, and there is no client talking to him, All the server GUI are died. I cannot click on the button to tells the client to stop waiting if there is no body is talking to him and stay idle.
Is there message handler for a pipe?
Thank you.
|
|
|
|
|
Hi!
I'm going to build a tool that should upload Windows 2000 domain user accounts on a webserver for login purposes... (It's needed for our school website www.leibniz-gymnasium.de to easily manage accounts for pupils)
Is there a way to get the account passwords (encrypted hashes are enough)?
And which encryption algorithm uses Windows 2000 Server? (to generate hashes from the user typed passwords)
I know that a level 3 NetGetUserInfo query returns a pointer structure (USER_INFO_3) containing a pointer to the password string - but this seems to be a null pointer in a Windows 2000 domain environment (as msdn tolds)
Thank you for helping!
Martin
|
|
|
|
|
I don't thing yo'll be able to get this information about the encripting algorithm because if someone knew it windows security would be very vulnerable if you know what I mean.
I you school there try to make an application like server<->client thing.
gabby
|
|
|
|
|
hi
ok, you may be right... but I thougt Windows uses some general algorithm like MD5 or anything else.
But the idea with an client<->server app is not bad. It's easier to use.
thx
Martin
|
|
|
|
|
A program I'm working on has been linking incredibly slowly. It'll show "Linking..." for less than half of the linking time, and then the rest of the time is spent "Creating library [programname].lib and object [programname].exp". The thing is, the program is an executable and thus shouldn't be making those files (which are only a few kilobytes in size), right? I can't find a reference to those files anywhere in the solution or project files, and none of the compiler/linker settings I've enabled/disabled have affected it. How do I stop those files from being built?
|
|
|
|
|
|
I actually figured out what was causing the problem: the project was including a header file from a DLL project that had dllexport's that weren't being #define'd out. Once I #define'd them out, the .lib and .exp files stopped being generated and links (especially incremental) were noticably faster .
|
|
|
|
|
Hiya I need to learn about licensing an app. Such as you have an app and say the maximum licence is 5, when 5 of the app are open, no others can be accessed.
I don't have a clue how to start to do this. Does anyone have any tutorials on app licensing??
Thanks.
|
|
|
|
|
You can accomplish this by using a semaphore or a memory mapped file (MMF). If a simple count is all you need then a semaphore will do nicely. If you need to share additional information you will need a MMF.
For a semaphore you set the maxium resource count to the number of licenses you wish to grant. That way only the specified number of processes can obtain the semaphore at any one time and any additional processes can be terminated.
For a memory mapped file you save a counter and when the number of licensed applications currently running is exceeded you deny any more processes from starting.
There are synchronization issues associated with any inter thread (process) communications and MMF sharing of information is no exception. If you need to know more about synchronization issues respond to this post and I will give more details.
|
|
|
|
|
Hey pals...look... it's so weird..
I have a property page where I save the data entered by the user to a database, the users can enter some personal informations about themselves and choose a image file, here is the problem...
if the user not choose a image file, opening a File Dialog, all data it's saved in the database when the " add information" button is pressed, but if the damn user choose a file, nothing happens no one record is added to the database..what is this?
make my day friends..help me hehehehee
thanks in advance...
|
|
|
|
|
This is a blanket question that is almost impossible to answer. The only advice I can give is to put well-placed breakpoints in the app, first of all in the "Add information" button handler. Go from there, inspect the contents of the variables, and finally, the saving function for the database.
|
|
|
|
|
Hi Johan, thank you for reply.
I have found the problem, I was using MyOleDB driver...so i change to MyOdbc and everything works fine...
|
|
|
|
|
I have been trying to get the time, but I need the millisec part also.
I used g_Date = CTime::GetCurrentTime(); // Date Time Now
to get
month1 = g_Date.GetMonth()/10;<br />
month2 = g_Date.GetMonth() - (month1 * 10);<br />
day1 = g_Date.GetDay()/10;<br />
day2 = g_Date.GetDay() - (day1 * 10);<br />
hour1 = g_Date.GetHour()/10;<br />
hour2 = g_Date.GetHour() - (hour1 * 10);<br />
min1 = g_Date.GetMinute()/10;<br />
min2 = g_Date.GetMinute() - (min1 * 10);<br />
sec1 = g_Date.GetSecond()/10;<br />
sec2 = g_Date.GetSecond() - (sec1 * 10);<br />
millsec = ?????
I did try
DBTIMESTAMP systemTime;
g_Date.GetAsDBTIMESTAMP (systemTime);
but got compile error GetAsDBTIMESTAMP not a member of CTime.
Any suggestions?
grahamfff
|
|
|
|
|
Just one idea.
You could use the Multimedia timer to maintain a count in milliseconds from some point in your program. Start the timer then save the date information, given this you can determine an approximation of the number of milliseconds. In order to make it more accurate, you would need to figure out how to get a one shot event that would occure the first time the time changed and then start the timer and save the date information. A possible one shot would be to just enter a loop that keeps checking thet date until the seconds change and then, since it should loop for less than a second (at start of program), the user probably would not notice the delay.
Good luck!
INTP
|
|
|
|
|
try to use the GetTickCount function
but you will need to set a timer and store you time somewhere
The GetTickCount function retrieves the number of milliseconds that have elapsed since the system was started. It is limited to the resolution of the system timer. To obtain the system timer resolution, use the GetSystemTimeAdjustment function.
DWORD GetTickCount(VOID);
or like this
VOID GetSystemTime(
LPSYSTEMTIME lpSystemTime // system time
);
Parameters
lpSystemTime
[out] Pointer to a SYSTEMTIME structure to receive the current system date and time.
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;
get it ?
gabby
|
|
|
|
|
I was just working on this a while ago and Mike Dunn pointed me in the direction of the FILETIME . With this you get 100 nanosecond resolution. Here's a quick example of what I did:
FILETIME start, end;
SYSTEMTIME st;
GetSystemTime(&st);
SystemTimeToFileTime(&st, &start);
GetSystemTime(&st);
SystemTimeToFileTime(&st, &end);
ULARGE_INTEGER time_start = *(ULARGE_INTEGER*)&start;
ULARGE_INTEGER time_end = *(ULARGE_INTEGER*)&end;
__int64 i64time_start = *(__int64 *)&time_start;
__int64 i64time_end = *(__int64 *)&time_end;
__int64 i64time_diff_ns = i64time_end - i64time_start;
__int64 i64time_diff_ms = i64time_diff_ns / 10 / 1000;
__int64 i64time_diff_sec = i64time_diff_ms / 1000;
char strdest_diff_ms[32];
char strdest_diff_sec[32];
_i64toa(i64time_diff_sec, strdest_diff_sec, 10);
_i64toa(i64time_diff_ms - i64time_diff_sec * 1000, strdest_diff_ms, 10);
char buffer[200];
char msg[] = "Time difference is %s.%s second(s).";
sprintf(buffer, msg, strdest_diff_sec, strdest_diff_ms);
::MessageBox(NULL, buffer, "Time Run Results", MB_ICONASTERISK |
MB_ICONINFORMATION);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Heh... But how do you compensate for things like OS tasks, other processes and threads running...?
Peace!
-=- James
Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"! Articles -- Products: Delete FXP Files & Check Favorites
|
|
|
|
|
Thanks Nick, that code will do just fine.
Graham.
grahamfff
|
|
|
|
|
The problem is that CTime does not have millisecond resolution (IIRC), so even if you used a method like CTime::GetAsSystemTime(...) to get the time into a SYSTEMTIME structure which includes milliseconds, it will not be a "true" millisecond value.
Use the Win32 GetSystemTime(...) function to get the current time (in UTC, so be sure to "localize" it before storing/using it) into a SYSTEMTIME structure that will contain a more or less accurate millisecond value.
[Edit]
BTW: Just because the database requires a millisecond value does not mean that it has to be a "true" value. If you only need second resolution, you can simply always set the millisecond value to zero...
[/Edit]
Peace!
-=- James
Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"! Articles -- Products: Delete FXP Files & Check Favorites
|
|
|
|
|
Hi,
I've asked a similiar a while back. You can check the post [^] and see if it comes any help. I found _ftime64() works quite well for my needs.
|
|
|
|
|
In regards to this thread (which I have yet to find a resolution)
http://www.codeproject.com/script/comments/forums.asp?msg=851353&forumid=1647#xx851259xx
I decided to strip away all header file includes from the code and compile the cpp files one by one in order to find the root of the problem.
All my header files are enclosed in the #ifndef #define #endif statement
and I include all necessary headers for a cpp file in a single header and along with other class and function definitions include that file...
eg.
MyFile.h
--------
#ifndef MYFILE_H
#define MYFILE_H
#include "OtherHeaderFile.h"
#include "OtherHeaderFile2.h"
class {
....
};
extern ...
#endif MYFILE_H
MyFile.cpp
----------
#include "MyFile.h"
As I start going down the list of compiled files I run into the syntax errors (from files that compiled fine higher up in the list in the list; errors are in the header files) when header files include each other as in the previous thread I posted. What are the general rules of header inclusion...there is something crucial I seem to be missing as far as these rules are concerned.
Can someone offer some advice?
|
|
|
|