|
Where is the WM_TEST message supposed to go ? Which thread does threadID designate ? Are you certain that this ID is correct ?
The message boxes are, by default, application modal. This means that the message pump handling of the application will pause for during the showing of the message box. In sequence 1, the results of posting the message WM_TEXT are visible only after you close the message box. In sequence 2, they MIGHT BE visible already during the showing of the box.
I say, might be, as PostThreadMessage returns before the message itself is handled. In sequence 2, the message is posted to the thread's queue, but if this thread is the same as which is to show the message box, then it might be that the message will not be handled before the message box is closed.
So, if threadID points to the same thread as which is to pop up the message box, then the thread's queue will be suspended until the closing of the box. You should never pop up modal message boxed in these type of situations. Use SendMessage to post a message to the thread's main window and wait for the window procedure to handle it. In this case, the application would either first show the message box, then handle the message, or vice versa.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi all,
Can anybody give me an example of Unicode programing. So I can change from current language to another (ex: Japanese to English) immediately.
Thanks all,
|
|
|
|
|
How can you send an email to like a hotmail account like someone@hotmail.com or any other web email???
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
|
I would like to send the email from my program.
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
ahh
well you might want to try some of the SMTP classes found here on codeproject
or investigate MAPI
unless of course you want to connect your program directly to Hotmail
Bryce
---
Publitor, making Pubmed easy.
http://www.sohocode.com/publitor
|
|
|
|
|
hi,
you need smtp class for send mail from ur program. u can refer http://www.naughter.com. very nice coding is there.
Have A Nice Day
Murali.M
|
|
|
|
|
thank you for the answer !
I used MAPI loosing some times, only to discover that it needs a mailing program already installed in my computer.
I hope that the smtp class do not require that, otherwise I cannot delete a single email on the server, for example, if I want to.
Do SMTP require that to ?
I also didn't find the code under http://www.naughter.com ( I didn't look thoughroughly into it though )
Thanks,
Marcello
|
|
|
|
|
I am trying to get process status information(cpu time, mem usage, etc) on all processes running on my Win XP system using C.
I have elevated the privilege of the current process to SE_DEBUG_NAME, but I get ERROR_ACCES_DENIED when I call OpenProcessToken() for the the following processes:
alg.exe
svchost.exe
svchost.exe
Task Manager reports that the user names for these processes are LOCAL SERVICE, LOCAL SERVICE, and NETWORK SERVICE respectively.
My goal is to extract the user sid from the process token so that I can display the user name like Task Manager does.
My program works for all other processes (except "idle").
1) What do I have to do to access the tokens for these processes?
It seems as if my current process is denied access to the process
token if the user name is either LOCAL SERVICE or NETWORK SERVICE.
2) How do I extract the same info for the idle process?
Thanks in advance
Daniel
|
|
|
|
|
Hello,
I am trying to add a cancel button to a modeless dialog I have created for my program. For this program, I enter information in the main dialog and when I click ‘Start’ a series of calculations are preformed. A second dialog box appears and acts as a status box – it sends information about the calculations to a text box in the second dialog. I have a cancel button on this second dialog that works, but only after EVERY calculation has been completed. My problem is this – I would like to have some way to check to see if the user has clicked the cancel button in between my calculation loop. Thanks in advance.
Loren
|
|
|
|
|
Hello,
You can add OnTimer() function in your main dialog. Include a code that will check say every 2 seconds if the modeless dialog is still open or not.
Example:
// say MyModeless is the modeless dialog object.
void CTFMHOSTView::OnTimer(UINT nIDEvent)
{
if(!MyModeless)
{ // means MyModeless has been closed
}
SetTimer(1,2000,0);// restart the timer again
CRecordView::OnTimer(nIDEvent);
}
rgrds,
Mar
Mar Solero Jr.
|
|
|
|
|
Spank me!! wrote:
My problem is this – I would like to have some way to check to see if the user has clicked the cancel button in between my calculation loop.
Either have the calculation done in a separate thread and stop this thread in your CANCEL-handler.
Or 'pump the message queue' in intervals while doing your calculation.
Call this function:
static bool PeekAndPump()
{
MSG msg;
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (!AfxGetApp()->PumpMessage())
{
::PostQuitMessage(0);
return false;
}
}
LONG lIdle = 0;
while (AfxGetApp()->OnIdle(lIdle++));
return true;
}
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I have an MDI application whose main window icon is different than its document icons. As a result, whenever a document is opened in XP, the main window icon is replaced with a generic window icon in the taskbar. It would seem that this should be something easy to fix, but I haven't been able to find a solution. Thanks for the help.
Mike
|
|
|
|
|
I wrote a winsock service that spawns a new thread on the "accept" function. Sometimes it seems that when I "recv" the client doesn't seem to have closed the connection gracefully? The service continues to peg the CPU at 100% (even though I have checked for SOCKET_ERROR and byte size of 0 returned from "recv").
My question is.....(code is "pseudo-pseudocode")
Can I rely on the following to work properly considering the problems that I have found with closing the socket on the client end?
int nTimeout = 1000;
nError = setsockopt(client, SOL_SOCKET, SO_RCVTIMEO, (char*)&nTimeout, sizeof(nTimeout));
Or, is something like this going to be more reliable (albeit pretty ugly...), where the "accept" calls a timer thread which in turn calls the client thread until it times out(as follows)?
UINT ClientTimerThread(LPVOID pParam) {
CWinThread* thread;
LPDWORD exitvalue;
if (WaitForSingleObjectEx(thread = AfxBeginThread(ClientThread,pParam), 10000, false) == WAIT_TIMEOUT) {
socket s = (SOCKET)pParam;
closesocket(s);
GetExitCodeThread(thread, exitvalue);
TerminateThread(thread, (DWORD) exitvalue);
}
return 0;
}
Any advice would be greatly appreciated...
~LizardWiz()
|
|
|
|
|
Please do not even consider applying your second solution: TerminateThread is not to be used unless under catastrophic conditions.
In Winsock2 SO_RCVTIMEO works fine (you sure is Winsock2 and not 1.1 what you're using?) Nevertheless, even if it didn't work that wouldn't justify the CPU peak. Can you post more of the reading code?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I wrote mfc program to send email using SMPT protocols. The program works, but I noticed the followings:
1- My email is recognized as junk mail by major .com companies such as yahoo..
2-Microsoft hotmail won't deliver my email even though I got confirmation (code 250, 221), however, when I get code 250 I see message: "Queued mail for delivery". I do not know why the email is queued, anyway I never receive it.
Thanks for any clue.
|
|
|
|
|
It's hard to say, but the server probably parses the message and notices some important SMTP header is missing. You can try catching the output of a commercial mail application and mimicking that in your program, just for testing purposes: then, carefully erasing one header at a time you'll find what the server is requiring as mandatory. Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
hi,
refer http://www.naughter.com for smtp class. smtp class code is there. it's working fine. this problem is not occured there. very nice code.
Have A Nice Day
Murali.M
|
|
|
|
|
hi everybody,
does anyone of you all know how to write covariance matrix and eig function in Visual C++?
or anyone of you noe any website got the Visual C++ maths function algorithm free for use?
thank you very much.
vincent sim
|
|
|
|
|
I am using a CTreeView and need to move the tree nodes using Drag and drop . Any ideas for sample code to move nodes. Help is appreciated .
|
|
|
|
|
Here[^]'s an useful article. HTH,
K.
There are many here among us who feel that life is but a joke.
But you and I, we've been through that, and this is not our fate,
So let us not talk falsely now,
the hour is getting late
|
|
|
|
|
I have a question regarding scrolling on rich edit controls. I want to scroll to the bottom of the control like when you click the vertical scroll bar. I tried the linescroll func with getlincount, but it only work when I 1st start the progam. When the user uses the scroll bar, this method does not work as expected. Instead, it give me a blank page (blank page but scroll bar at bottom). Is there Cwnd function that I should used instead. Thank you for any help.
|
|
|
|
|
Hi, i'm trying to implement the Darkside mini SQL library in my ISAPI extension DLL. I tested the library before with a console application and it worked great, but not with my ISAPI dll... I get the following errors:
MHExtension.cpp
c:\dsqlm_1\include\dsql_m_structs.h(46) : error C2059: syntax error : 'constant'
c:\dsqlm_1\include\dsql_m_structs.h(46) : error C2143: syntax error : missing ';' before '}'
c:\dsqlm_1\include\dsql_m_structs.h(47) : error C2377: 'INT' : redefinition; typedef cannot be overloaded with any other symbol
c:\program files\microsoft visual studio\vc98\include\windef.h(161) : see declaration of 'INT'
c:\dsqlm_1\include\dsql_m_structs.h(47) : error C2377: 'FLOAT' : redefinition; typedef cannot be overloaded with any other symbol
c:\program files\microsoft visual studio\vc98\include\windef.h(145) : see declaration of 'FLOAT'
c:\dsqlm_1\include\dsql_m_structs.h(47) : error C2377: 'CHAR' : redefinition; typedef cannot be overloaded with any other symbol
c:\program files\microsoft visual studio\vc98\include\winnt.h(134) : see declaration of 'CHAR'
c:\dsqlm_1\include\dsql_m_structs.h(48) : error C2377: 'BOOL' : redefinition; typedef cannot be overloaded with any other symbol
c:\program files\microsoft visual studio\vc98\include\windef.h(142) : see declaration of 'BOOL'
c:\dsqlm_1\include\dsql_m_structs.h(64) : error C2146: syntax error : missing ';' before identifier 'unique'
c:\dsqlm_1\include\dsql_m_structs.h(64) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(64) : error C2501: 'unique' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(65) : error C2146: syntax error : missing ';' before identifier 'indexed'
c:\dsqlm_1\include\dsql_m_structs.h(65) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(65) : error C2501: 'indexed' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(66) : error C2146: syntax error : missing ';' before identifier 'nullable'
c:\dsqlm_1\include\dsql_m_structs.h(66) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(66) : error C2501: 'nullable' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(67) : error C2146: syntax error : missing ';' before identifier 'in_active'
c:\dsqlm_1\include\dsql_m_structs.h(67) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(67) : error C2501: 'in_active' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(70) : error C2629: unexpected 'class Column ('
c:\dsqlm_1\include\dsql_m_structs.h(70) : error C2238: unexpected token(s) preceding ';'
c:\dsqlm_1\include\dsql_m_structs.h(83) : error C2061: syntax error : identifier 'boolean'
c:\dsqlm_1\include\dsql_m_structs.h(84) : error C2146: syntax error : missing ';' before identifier 'isUnique'
c:\dsqlm_1\include\dsql_m_structs.h(84) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(85) : error C2061: syntax error : identifier 'boolean'
c:\dsqlm_1\include\dsql_m_structs.h(86) : error C2146: syntax error : missing ';' before identifier 'isIndexed'
c:\dsqlm_1\include\dsql_m_structs.h(86) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(87) : error C2061: syntax error : identifier 'boolean'
c:\dsqlm_1\include\dsql_m_structs.h(88) : error C2146: syntax error : missing ';' before identifier 'isNullable'
c:\dsqlm_1\include\dsql_m_structs.h(88) : error C2501: 'boolean' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(99) : error C2143: syntax error : missing ';' before '*'
c:\dsqlm_1\include\dsql_m_structs.h(99) : error C2501: 'Database' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(99) : error C2501: 'db' : missing storage-class or type specifiers
c:\dsqlm_1\include\dsql_m_structs.h(103) : error C2629: unexpected 'class Table ('
c:\dsqlm_1\include\dsql_m_structs.h(103) : error C2238: unexpected token(s) preceding ';'
c:\dsqlm_1\include\dsql_m_structs.h(151) : error C2143: syntax error : missing ';' before '}'
c:\dsqlm_1\include\dsql_m_structs.h(151) : error C2143: syntax error : missing ';' before '}'
c:\dsqlm_1\include\dsql_m_structs.h(151) : error C2143: syntax error : missing ';' before '}'
c:\dsqlm_1\include\sql_lexer.h(39) : error C2143: syntax error : missing ';' before '{'
c:\dsqlm_1\include\sql_lexer.h(39) : error C2447: missing function header (old-style formal list?)
c:\dsqlm_1\include\bridge.h(101) : error C2079: 'table' uses undefined class 'Table'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(18) : error C2143: syntax error : missing ';' before '__stdcall'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(18) : error C2501: 'BOOL' : missing storage-class or type specifiers
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(18) : error C2371: 'BOOL' : redefinition; different basic types
c:\dsqlm_1\include\dsql_m_structs.h(48) : see declaration of 'BOOL'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(38) : error C2143: syntax error : missing ';' before '__stdcall'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(38) : error C2501: 'BOOL' : missing storage-class or type specifiers
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(38) : error C2371: 'BOOL' : redefinition; different basic types
c:\dsqlm_1\include\dsql_m_structs.h(48) : see declaration of 'BOOL'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(425) : error C2143: syntax error : missing ';' before 'tag::id'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(425) : error C2501: 'BOOL' : missing storage-class or type specifiers
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(425) : error C2371: 'BOOL' : redefinition; different basic types
c:\dsqlm_1\include\dsql_m_structs.h(48) : see declaration of 'BOOL'
D:\Programming\Projects\VC++ Projects\MordredsHaven\MHExtension.cpp(425) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
Something to do with the types already defined in windef.h.. but i don't see why it says that since there's no type redefinition, just an enum, like this (dsql_m_structs.h):
class MyDate;
namespace dsqlm {
class Database;
enum boolean { FALSE=0,TRUE=1 };
enum DsqlType {SMALLINT,INT,BIGINT,FLOAT,DOUBLE,CHAR,VARCHAR,
DATE,TIME,TIMESTAMP,BOOL,AUTOID,UID};
enum ComparissonOperator {EQUALS,NOT_EQUALS,GREATER_THAN,LESSER_THAN,
GREATER_THAN_OR_EQUAL_TO,LESSER_THAN_OR_EQUAL_TO,
LIKE};
enum LogicalOperator {AND,OR};
...
Does anyone see how i could fix it? I really need the database..
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
Hello,
Here is the question:
Is it possible to modify an exception inside a catch block and then rethrow it ?
Under
http://www.codeproject.com/cpp/ANSI-cpp-dec96/except.asp
the only point I see connected to this question is:
19When the handler declares a non-constant object, any changes to that
object will not affect the temporary object that was initialized by
execution of the throw-expression. When the handler declares a refer-
ence to a non-constant object, any changes to the referenced object
are changes to the temporary object initialized when the throw-expres-
sion was executed and will have effect should that object be rethrown.
But this is confusing to me because it seems that is possible to modify a
const exception while it is not possible to modify a non const exception:
which is exactly the contrary that I would expect !
like:
<br />
catch ( BasicException& e ) {<br />
e.setMessage( e->getMessage() + " some more informations here " );
throw;
}<br />
<br />
catch ( const BasicException& e ) {<br />
e.setMessage( e->getMessage() + " some more informations here " );
throw;
}
Thank you in advance for any answer
Marcello
P.S.
If it is not clear enough what I need to do, here is an example:
<br />
typedef std::basic_string<VCFChar> String;<br />
<br />
class BasicException : public std::exception {<br />
public:<br />
BasicException( const VCF::String & message ) {<br />
message_ = message;<br />
}<br />
<br />
void setMessage( const VCF::String & message ) {<br />
message_ = message;<br />
}<br />
String getMessage () {<br />
return message_;<br />
}<br />
String message_;<br />
}<br />
<br />
<br />
class A {<br />
void f() {<br />
bool error = true;<br />
if ( error ) {<br />
throw BasicException( "original message" );<br />
}<br />
}<br />
<br />
void g() {<br />
try {<br />
f();<br />
}<br />
catch ( BasicException& e ) {<br />
e.setMessage( e->getMessage() + " some more informations here " );<br />
throw;
}<br />
};<br />
<br />
int main(int argc, char *argv[])<br />
{<br />
A a;<br />
try {<br />
a.g();<br />
}<br />
catch ( BasicException& e ) {<br />
cout << e.getMessage() << endl;<br />
}<br />
}<br />
|
|
|
|
|