|
|
In addition to GetCommandLine() , there's also the __argc /__argv pair.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Some time back i come across an api which notify the application about registry change, but due HUMAN NATURE of forgeting thing at time they urgently required..... I too forget that api!!!
is any body remember that api!!!?
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
|
Hi,
I am trying to call the following code within a WH_GETMESSAGE hook procedure and it works fine. But the same piece of code fails inside a WH_JOURNALRECORD hook procedure. Can anyone help me in this regard.
void EnumIE()
{ CoInitialize( NULL );
SHDocVw::IShellWindowsPtr spSHWinds;
spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows));
long nCount = spSHWinds->GetCount();
IDispatchPtr spDisp;
for (long i = 0; i < nCount; i++)
{ _variant_t va(i, VT_I4);
spDisp = spSHWinds->Item(va);
SHDocVw::IWebBrowser2Ptr spBrowser(spDisp);
if (spBrowser != NULL)
{ MSHTML::IHTMLDocument2Ptr spDoc(spBrowser->GetDocument());
if (spDoc != NULL)
{ HWND hWnd = NULL;
spBrowser->get_HWND ((long*)(&hWnd));
}
}
}
CoUninitialize();
}
|
|
|
|
|
Hi,
Can anybody share some ideas on how to catch STL exceptions in a C++ code.
I would appreciate if some pseudocode or a link is provided with regard to this.
Thanks,
JOE
|
|
|
|
|
#include <exception>
#include <iostream>
try {
}
catch (const std::exception &err) {
std::cerr << err.what() << std::endl;
}
|
|
|
|
|
ALOK
I HAVE A XML WHOSE XMLDOMDocumentPtr IS pIDomOutDoc.
wchar_t *wcstr=pIDomOutDoc->xml;
//pIDomOutDoc->xml; returns the xml in unicode
out_XML= (char *)malloc( MB_CUR_MAX);
//out_XML STORES THE OUTPUT
wcstombs(out_XML,wcstr,MB_CUR_MAX);
::AfxMessageBox(out_XML);
BUT I AM NOT GETTING CORRECT OUTPUT.THE RESULT PRINTED OUT IS SOMETHING LIKE <yyyy>yyyy
|
|
|
|
|
alok
sorry to disturb u. i did it .i replace the MB_CUR_MAX BY CHAR[1000].BUT I WANT TO MAKE IT INDEPENDENT OF THE SUBCRIPT VALUE.
|
|
|
|
|
|
I want to convert the date and time in the character array format ( Wed, 16 Mar 2005 04:16:39 GMT ) to timestamp value using c++.
Thanx
|
|
|
|
|
Have you looked into COleDateTime::ParseDateTime() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have created an ATL composite control, and am putting it on multiple instances of a modeless dialog box. For each instance of the control I am calling its draw function with different parameters but the multiple instances all display with the same parameters. What is happening and how do I get around this problem.
Esteemed members please help.
Deekonda Ramesh
|
|
|
|
|
Hi-
I have developed an ActiveX and I want it to use in browser, how can I give Params to the ActiveX, I overloaded the load method... but how the parameters will be read?
I have added the following piece of code in the header file,
BEGIN_COM_MAP(CiRemotePCActiveXCtrl)
COM_INTERFACE_ENTRY(IPersistPropertyBag)
END_COM_MAP()
and it gives me error messages,
error C2039: 'Lock' : is not a member of 'ActiveXCtrl'
error C2039: 'Unlock' : is not a member of 'ActiveXCtrl'
error C2259: 'ActiveXCtrl' : cannot instantiate abstract class
error C2440: 'static_cast' : cannot convert
from 'ActiveXCtrl::_ComMapClass *' to 'IPersistPropertyBag *'
error C2440: 'initializing' : cannot convert from 'ATL::_ATL_CREATORARGFUNC (__stdcall *)' to 'DWORD_PTR'
error C2660: 'CCmdTarget::InternalQueryInterface' : function does not take 4
arguments
I also implemented my class with 'IPersistPropertyBagImpl' interface,
Please help me in solving the problem,
Thanks in advance,
dwurity
Dharmendra
|
|
|
|
|
Have anybody had deal with neural networks????
I got one problem now, i need a good PCA aglirithm, it will be excellent if anybody give me a link to the source and theory. Especially i'm interesting in Oja, Sanger , Hebbian neural networks that make PCA.
And another question.. Shame on me, but i can't remember how to do it I got The DIB section (only bitmapinfoheader and array of bits), so i want to copy them to HDC. I'm using the source from Codeproject about capturing the images from AVI, and int saves them in the files, i would like to copy them to HDC as i said....
Thanks.
|
|
|
|
|
Rassul Yunussov wrote:
i want to copy them to HDC
If you have a DIB section, then you may have a handle to the DIB section, in which case BitBlt.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
hello,
my application asks the user to enter a few words and the application arrange these words to create a 15x 15 crossword puzzle .
do you know any alogrithm that can help me to arrange the words in a way that gets the best result
|
|
|
|
|
|
Hello Friends,
Please observe the code which is given below
#include <iostream.h>
int main()
{
for(int i=0 ; i<=10 ;i++ , cout << i << endl );
cout << endl;
return 0;
}
Please observe the the second which is given below
#include <iostream.h>
int main()
{
for(int j=0 ; j<=10 ;j++ )
cout << j << endl;
return 0;
}
My question is how is it possible to use cout in the inside the for loop.Is their any difference in the between the two program? Can anyone point the difference in terms of cpu speed,memory management etc.What is advantage of writing the code as you saw in the first section of the code ie the first program
Hoping for a reply.
Best Regards,
Phijo
|
|
|
|
|
1. Yes it is possible to use cout inside the for loop.
2. The fragments are not the same: the first one prints 1 through 11 with a new line at the end; the second prints 0 through 10.
3. The pseudo code for the ‘for’ loop:
for (expression1; expression2; expression3)
{
Body;
}
is somewhat like this:
EXECUTE expression1;
LABEL1:
IF expression2 is FALSE GOTO LABEL2
EXECUTE Body;
EXECUTE Eexpression3
GOTO LABEL1
LABEL2:
This pseudo code should answer why the fragments do not provide the same results. Note that the 1st fragment has an empty body.
4. From CPU usage point of view, the 1st one executes 11 'cout << i' operations and 12 times flushes the buffer (‘cout << endl’), whereas the 2nd one - 11 and 11 respectively, so the second one is faster.
5. From the code size point of view, the 2nd one is smaller as it contains 2 cout calls, whereas the 1st one – 3.
6. It is hard to say about advantages as the two are not equivalent from the point of view of producing the result.
Serge
|
|
|
|
|
well first thingz first!!!!!...
both of them should work.....
and the first example program that u have shown is a BAD style of writing the code.....
both ur programz WILL GIVE DIFFERENT OUTPUTZ!!!!!
ur first program is like thiz.....
#include
int main()
{
for(int i=0 ; i<=10 ;i++ , cout << i << endl );
cout << endl;
return 0;
}
the OUTPUT TO THE FIRST ONE SHOULD BE.....
1
2
3
4
5
6
7
8
9
10
11
OBSERVE.....
the third argument that u give in the for loop is basically executed only AFTER the whole loop is done.....since i++is incremented first the output changez and is different from the second program
the second program that u have shown ......
#include
int main()
{
for(int j=0 ; j<=10 ;j++ )
cout << j << endl;
return 0;
}
the OUTPUT TO THE FIRST ONE SHOULD BE.....
0
1
2
3
4
5
6
7
8
9
10
i dont see any advantages in writing the first way.....what i think is that itz a bad style ......
as far as memory and processor speedz concern.....i think u wouldnt find much of a any difference.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|
|
An interesting question.
I would guess (but it is only a guess) that there will be no difference, i.e. the compiler will reduce them to about the same code, so the CPU speed, memory management, etc will all be about the same.
((I stand corrected, having seen the other replies. Unfortunately I could not do the obvious check - running them - since my office PC does not have C++ installed. I think the rest of the comments below are still valid, however!))
To find differences in timing, you could use both approaches, but check performance using the profiler. This may force you to use debug version, and turn off optimisation, so it may give you misleading results.
To check memory management, etc, you could compile with the "generate assembler listing" option ON, and compare the resulting listings.
|
|
|
|
|
A for statement is comprised of three expressions: init, condition, and loop. All three are optional. The init expression is evaluated once. The condition expression is evaluated once before each iteration of the loop. The loop expression is evaluated once after each iteration of the loop.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi, there,
I created Message Text File and one of the messages has 4 parameters.
MessageId = 0x1000
Facility = Application
Severity = Informational
SymbolicName = MSG_NORMAL
Language = English
%1 %2 %3 %4
.
Then I use FormatMessage function to retrive the message by ID and
pass the parameters in. But I can't get the string I want.
DWORD_PTR args[4] = { (DWORD_PTR)(&string1),
(DWORD_PTR)(&string2),
(DWORD_PTR)(&string3),
(DWORD_PTR)(&string4)};
// Retrieve the English message string.
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_HMODULE |
FORMAT_MESSAGE_ARGUMENT_ARRAY,
ghResDll,
EVENT_MSG_SESSION_NORMAL,
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
(LPTSTR) &lpMsgBuf3,
2048,
(va_list*)(&args));
Then
evtLog->LogIt( EVENTLOG_INFORMATION_TYPE, 1,
EVENT_MSG_SESSION_NORMAL, pMsg3, 1 );
So in event log is %2 %3 %4
Can anyone tell me where is wrong with my code? Thanks In Advance.
|
|
|
|
|
What does your LogIt() method do? Shouldn't lpMsgBuf3 be sent to it instead of pMsg3 ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|