|
Did you try:
CHtmlView::OnShowContextMenu
And this will do the job anyway:
By implementing IDocHostUIHandler interface.
this is this.
|
|
|
|
|
Friends,
In my MFC based application, the main application window is somethime visible and sometimes not. Whn i made my window invisible using ShowWindow(0) , its taskbar button also becomes invisible. What i want is that task bar button should remain visible whether application windows is visible or not.
How can i do so?
Imtiaz
|
|
|
|
|
Imtiaz Murtaza wrote:
Whn i made my window invisible using ShowWindow(0)
Instead of making it Invisible by calling ShowWindow(SW_HIDE), resize it to 0,0 so that window become invisible from desktop but taskbar button remain visible
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
Hi,
While working with CAsyncSocket we discovered that our application has a memory leak. Tracing it we finally found that inside CAsyncSocket class a new window is created for every socket object. Trying the following code:
for (int i=0; i<6000; i++)
{
CWnd* pWnd = new CWnd;
pWnd->CreateEx(0, AfxRegisterWndClass(0),_T("Socket Notification Sink"),
WS_OVERLAPPED, 0, 0, 0, 0, NULL, NULL);
pWnd->DestroyWindow();
delete pWnd;
::Sleep(10);
}
we tested it to realize that it causes a memory leak in our app.
Is there some problem with CreateEx?
|
|
|
|
|
Are you sure that the memory leak is a CWnd object?
Don't try it, just do it!
|
|
|
|
|
I'm not sure where the leak is, but if I change the call to CreateEx (for example different styles for the window) I can't see it anymore.
|
|
|
|
|
There is an easy way to trace memory leaks.
When your application closes, then you remember the byte count of the leaks the debugger is displaying.
Now set a checkpoint at the new operator routine (breakpoint at a new call, and then step into) with a condition of n = byte count.
Now the debugger will break every time an object with size n is allocated... just step out of the new operator and you will see what object it is.
Don't try it, just do it!
|
|
|
|
|
The debugger doesn't report a memory leak, that's why it's so confusing. But looking at the amount of memory the application consumes it constantly goes up and only goes down when I close the app.
If you can try those few lines of code I posted above you will see it happening.
|
|
|
|
|
Hi,
im trying to use the specific value of an array in a computation in another function; but don't know how to set it up. In test(), i want to use the 6th value of C[] in the computation. How do i set this up please?
<br />
#include "stdafx.h"<br />
#include <cmath><br />
<br />
const int size = 10;<br />
double A[size] = {0},B[size] = {0}, C[size],c,d;<br />
<br />
double PI = 3.141592653589793238462643383279502884197;<br />
<br />
void rah(double C[])<br />
{<br />
<br />
for (int i=0;i<size;i++)<br />
{<br />
A[i] = sqrt(10*i);<br />
B[i] = 2*PI*i;<br />
C[i] = A[i]*B[i];<br />
}<br />
}<br />
<br />
double test()
{<br />
rah(C);<br />
d = PI * rah(C[5]);<br />
<br />
}<br />
<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
test();<br />
return 0;<br />
}<br />
<br />
|
|
|
|
|
i am not clear abt ur requirement. try this
#include <stdio.h>
#include <math.h>
const int size = 10;
double A[size] = {0},B[size] = {0}, C[size],c,d;
double PI = 3.141592653589793238462643383279502884197;
double rah(double *C)
{
int i = C-::C ;
A[i] = sqrt(10*i);
B[i] = 2*PI*i;
::C[i] = A[i]*B[i];
return ::C[i] ;
}
double test()//how do i write this correctly?
{
d = PI * rah(&C[5]);
return d ;
}
int main(int argc, char* argv[])
{
printf("Hello World!\n %f", test());
return 0;
}
naren
VC++ programmer
|
|
|
|
|
aaadetos wrote:
In test(), i want to use the 6th value of C[] in the computation. How do i set this up please?
double test()//how do i write this correctly?
{
rah(C);
d = PI * rah(C[5]);
}
It appears that you are already using "the 6th value of C[] in the computation." What is it that you think is wrong?
The code that I do see as wrong is when you are calling the rah() function. rah() is expecting a double array (i.e., C[] ), yet you are calling it with a single double value (i.e., C[5] ).
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks a lot guys. The dilemma was to use one of the elements (the 6th) in the computation. I implemented test() in the following way:
<br />
double test()<br />
{<br />
rah(C);<br />
d = PI * C[5];<br />
return d;<br />
}
|
|
|
|
|
Why is d a global variable? Unless absolutely necesssary, that is very poor practice. In this instance, it makes no sense for test() to return d since it is already global. Either make d local to the test() function, or change test() to return nothing.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi!
I have a begginers question. How do I provide many options in one function argument like Win32 API does for example (not real function):
a.) DrawDialog(FRAMED | GREY | BOLD);
Here dialog window will have all requested behaviour.
b.) DrawDialog(FRAMED);
Here dialog window will be just framed, other options will be something by default.
I'd like to do something like that in my program. I have many LED's with colours green, red, orange. Example:
a.) SetLED(green, red, orange);
In this case all LED's with this colour would be led up.
b.) SetLED(green, orange);
In this case all LED's with this colour green and orange would be led up, green would be left alone.
Can anyone please help me and sugest how do I do that?
Best regards,
Rostfrei
|
|
|
|
|
It is not using multiple arguments but using one single argument that is used as a flag:
<br />
#define LED_GREEN 0x001<br />
#define LED_BLUE 0x002<br />
#define LED_RED 0x004<br />
The define are just to set one bit to 1
And so, inside your function, you check if the specified bit is set:
void SetLed(int LedMask)<br />
{<br />
if (LedMask & LED_GREEN)<br />
<br />
...<br />
...<br />
}<br />
[EDIT] I forgot to say that:
You can then call your function like that:
SetLed(GREEN_LED | RED_LED);
That will activate the green and red leds
Hope this helps
|
|
|
|
|
That is exactly what I needed. Thank you!
Rostfrei
|
|
|
|
|
hiho@ll
i'm working on a browser helper object, which should have a "Boss coming" feature
the problem is how can i change the Location URL of IE?
what i do:
to load the url fast i have a local copy of google index.htm site with the google logo
i'm loading the file using navigate function, but the Location points to a local file!
using the IWebBrowser interface i only found a get_LocationURL function, but i need a set_LocationURL!!
anybody knows such a function
thx@ll
|
|
|
|
|
I have an activeX control and need to make a setup program and force setup to call DllRegisterServer , how can I achieve this?
|
|
|
|
|
I think a good way to do that is to use an installation program (like InstallShield). This program will call regsvr32 that will register the ActiveX for you.
|
|
|
|
|
Hi ,
I programmed an activeX control with VC++. I added a ClickEvent and a method OnLButtonUp that fires this event, when you click on the control. In the testcontainer of Visual Studio this works fine.
Now I loaded my control into excel. Here nothing happens when I click on the control. Debugging showed me, that my OnLButtonUp is never called.
How do I get the Click Event in Excel?
Can somebody help me?
Thx,
Mimmi511
|
|
|
|
|
Hi all
i have made an mfc dialog based application "test" .there is a dialog named testdlg , a generic class named CStart and a com class named CCall .
in testdlg.h file there is #include "Start.h" . in start.h there is #include "Call.h" . i want to add #include "testdlg.h" in Call.h ,but there is 8 error "IDD_TEST_DLG undeclared identifier and Expected constant expression " on the line enum {IDD=IDD_TEST_DLG} in testdlg.h file .
|
|
|
|
|
You should include resource.h before you include TestDlg.h..
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I believe that headers should provide all information necessary to use them. Since that header requires Resource.h it should include it in my opinion. Therefore, I do this in my dialog headers :
#ifndef IDD_TEST_DLG
#include "Resource.h"
#endif
|
|
|
|
|
Hi all:
I have a pure white background imagelist which is used for the TabCtrl. But what the problem is when I add this icon to the TabCtrl, it seems it didn't mask the white back ground out. The following is the code
bitmap.LoadBitmap(IDB_ICON);<br />
imgList.Add(&bitmap, RGB(255, 255, 255));
tabctrl.SetImageList(&imgList);<br />
tabctrl.InsertItem(0, "", 0);
I've tried imglist.SetBKColor(CLR_NONE); the result is still the same!
Can anyone help me fix the problem?
|
|
|
|