|
If the checkbox is a CButton object, just use the GetCheck() method.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have a modal dialog doing lengthing processing, and if the parent window (Form/View app) loses focus, the Parent window is not repainted, and only the animation control on the dialog is repainted. I´ve tried to avoid this using sleep(0), but to no effect. Has anyone any ideas?
Thanks
phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
You can move the lengthy process to a different thread, perhaps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
The problem is I´m working with a Access database using DAO (MFC derived classes), and that is not thread safe. All I am doing is importing values from different tables from one DB to another.Dependent on the size of the data to import, this can take many minutes. I´m having to use do..while loops and this is obviously very CPU intensive. I´ve introduced sleep(0), to break the CPU usage a bit, but still have problems with the Main application painting. I´ve tried using GetParent()->RedrawWindow() from the Modal dialog, and funny enough, in the debug version this works, but when I compile in release, the modal dialog and the Main window are repainted, as long as no other window/app gets the focus. When I change back to my app, so that it has focus, both modal dialog and main app window are just plain white, and when the modal dialog gets focus, the task manager insists that it is not responding, but if I let it run, the task completes successfully. I´m no expert(as you can probably tell), but this has really got me stumped!
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
Hello. I have many message boxes to write and think I need a class to do it because I need some extra features to them compared with standard message boxes. I would want to create a message box giving it a style to use but specify that all buttons are MFC CButton objects so that I can add features to the buttons like tooltips and other features.
I would write dialogs for each message box I use but if I need to change the size of text on any one message box I would have to have a different dialog for every message box with different text on it.
Help please!
|
|
|
|
|
Say you're calling CMyMessageBox to your MessageBox replacement; then, add with the wizard a CString member associated with the text field where the message is displayed, and modofy the ctor of CMyMessageBox so that it accepts a message and assigns it to that variable. Automatically you can have as many messages displayed as you want. You can add to your customization by letting the user select the type of message box (yes/no, accept/cancel, and so on), that's a little more dificult, but not much.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
i'm writing a small program to help me keep track of how my computer (at a remote location) is being used. My small app runs on the remote computer, and registers data every 10mins, one is how long the system has been idle. (or more precise, if it has been used the last 10 mins).
I also would like to register if the current session is a remote session (eg accessed with remote desktop), to see if i myself was accessing the computer at that point, or if some other person was using the computer locally.
Is there any api i can ask to find out if the computer is (currently) being accessed via remote desktop?
thanks
Thomas
|
|
|
|
|
The WTSRegisterSessionNotification function registers the specified window to receive session change notifications. >> So your app can know when the state has changed (a remote session joins or not?).
The WTSEnumerateSessions function retrieves a list of sessions on a specified terminal server. >> In case you are writing a service (they do not usually have windows).
The WTSGetActiveConsoleSessionId function retrieves the Terminal Services session currently attached to the physical console. The physical console is the monitor, keyboard, and mouse. Note that it is not necessary that Terminal Services be running for this function to succeed. >> To distinguish if the 'current' session is remote or not.
The WTSQuerySessionInformation function retrieves session information for the specified session on the specified terminal server. It can be used to query session information on local and remote terminal servers. >> You can find out if session is rmeote or not, and all sorts of other infromation you might want to track.
|
|
|
|
|
I am trying to monitor when a paticular process starts up.
The way I am doing it now:
I used SetTimer() to call ON_TIMER
in OnTimer() I enumerate all running process and check to see if the app I am looking for is running. If it is I create a process handle to it and call KillTimer(TimerHandle) to stop the timer messages.
Problem:
Even though I call KillTimer() I still get OM_TIMER messages and can't stop the check for the running process. Just wondering if anybody nows a better way to continually poll for running processes or if anybody knows why the call to KillTimer isn't working.
Thanks in advance.
|
|
|
|
|
Hello,
I was wondering if any of you CPers know how to solve this problem i've come across with.
I've defined about four or so methods in this class of mine as inline and, it appears, the linker cannot find the method's definitions in the .OBJ .
The only way of solving this issue is by NOT defining the method(s) as inline . How do I do about solving this, while at the same time keeping inline declaration?
Thanks a lot
David
Linker Error:
Linking...
LINK : LNK6004: Debug/xtest.exe not found or not built by the last incremental link; performing full link
xtestDlg.obj : error LNK2001: unresolved external symbol "public: char const & __thiscall XField::GetText(void)" (?GetText@XField@@QAEABDXZ)
Debug/xtest.exe : fatal error LNK1120: 1 unresolved externals
|
|
|
|
|
inline methods must come in headers. Are you by chance defining the method in some .cpp instead?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Yes, that is true.
I have defined it in the class declaration - in the header file - and I've coded the method(s) in the actual source file (.cpp ) .
I take it you mean I can't insert the code in the source file but only in the header?
David
BTW, thanks for the reply
|
|
|
|
|
Hi guys
Somebody knows what's the fast way to generate a random (or pseudorandom) array of numbers of 100.000 positions?
Thanks in advance
Doc
|
|
|
|
|
Are you wanting 100,000 numbers, or are you wanting numbers with 100,000 digits?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I want a list of 100.000 numbers randomly sorted.
Doc
|
|
|
|
|
doctorpi wrote:
I want a list...
But the subject indicates an array. I'll show an example for an array.
int nNumbers[100000];
for (int x = 0; x < sizeof(nNumbers) / sizeof(int); x++)
nNumbers[x] = rand();
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks
But maybe I haven't explained me well.
At the beginning I have an array where nNumbers[i]=i; then I have 100.000 numbers. After the process that I don't know how to do I want to have the array with all the numbers from 0 to 100.000 but unsorted.
I'm thinking in exchange 2 positions N times, but how I can generate a number between 0 and 100.000 because rand() is not valid for me.
Thanks again
Doc
|
|
|
|
|
doctorpi wrote:
...how I can generate a number between 0 and 100.000 because rand() is not valid for me.
You are right. rand() returns a maximum value of RAND_MAX . Here is a pseudo-random number generator that I've used in the past:
static unsigned long Seed = 1;
#define A 48271L
#define M 2147483647L
#define Q (M/A)
#define R (M%A)
double Random( void )
{
long TmpSeed;
TmpSeed = A * (Seed % Q) - R * (Seed / Q);
if (TmpSeed >= 0)
Seed = TmpSeed;
else
Seed = TmpSeed + M;
return (double) Seed / M;
}
void Init( unsigned long InitVal )
{
Seed = InitVal;
}
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Thanks guys
I think I've got it.
Doc
|
|
|
|
|
Hi all,
We hope customers get new info from our web on time.
I want to do in this way:
add a web-page which includes some texts, i.e. "expire", "update" etc.
when program (used by customers) is running, it reads the web-page (it is hidden from customers) and does something according to texts on the page.
I don't want to use tcp/ip - we only have simply tasks.
do you know how to download a web-page silently (users don't know)?
or any other suggestions for my needed?
thx
includeh10
|
|
|
|
|
Why do you want the user to use an application which read a web page, why not use only the web page, with no application. Maybe you should use the CHTMLView, or something like that, I forgot the class
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
I know try using CWebBrowser
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Hi, I am trying to use the PostMessage function by importing it through DLL import in C# with the following definition.
[DllImport("user32.dll")]
static extern bool PostMessage(IntPtr hWnd, int msg, Int32 wParam, IntPtr lParam);
Can someone give an example of what you would pass in order to get a keystroke, and a mouse click? Really, I do not understand what needs to go in for wParam, or lParam.
Thank you for your help in advance.
|
|
|
|
|
It depends what you need at the other end; there's a simple answer and a complicated one.
The simple answer is to look in MSDN for:
Keystroke: WM_CHAR
Mouse click: WM_xBUTTONy (where x is L or R and y is UP, DOWN or DBLCLK)
It can be more complicated if you need WM_KEYDOWN , WM_KEYUP , WM_SYSKEYDOWN , WM_SYSKEYUP , WM_SYSCHAR and so on.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|