|
i made a dll in which
i added a microsoft web browser control in a dialogue
but it doesnt shows the dialogue box. but if i remove the web browser control
then it works well.
please suggest someway
|
|
|
|
|
I recommend using shdocvw.dll. Is what Internet Explorer uses to navigate. Is on windows/system32
|
|
|
|
|
I have made a window in Win32. I would like to somehow handle the minimize event, so I can do stuff when the user clicks the minimize button. Does anyone have any clue how to do this? Any help is appreciated.
-Dev578
|
|
|
|
|
Both of the links I posted to your previous question 'Running a program in the taskbar' show how to handle the minimize event (or, one way of doing it)
Did you look at these examples ??
There are plenty of other examples, you can search here, or google
In general terms, when designing (say a dialog app), you must set 'Minimise Box' under Dialogue Properties -> Styles.
You then write/modify the handler for the 'OnSysCommand' - an example of such is shown below :-
void CMBFGWMS1Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
// Decide if minimize state changed
bool bOldMin = bMinimized_;
if (nID == SC_MINIMIZE) {
bMinimized_ = true;
}
else if (nID == SC_RESTORE) {
bMinimized_ = false;
}
CDialog::OnSysCommand(nID, lParam);
if (bOldMin != bMinimized_) {
// Minimize state changed. Create the systray icon and do
// custom taskbar button handling.
SetupTrayIcon();
SetupTaskBarButton();
}
}
}
the line
nID == SC_MINIMIZE
is actually the bit that checks to see if the minimise button/request was activated (since there are a number of different requests that all come through OnSysCommand) - this is how the request is handed to your program ...
How about you try using one of the examples, and post some code back to CP if you want more help - its easier for us to work with 'posted code' than vapour ....
'G'
|
|
|
|
|
OnSize (with type == SIZE_MINIMIZED)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
And another way is to handle WM_NCLBUTTONDOWN or WM_NCLBUTTONUP messages and check wParam parameter for HTMINBUTTON value. You should read in MSDN for more information .
|
|
|
|
|
Hi,
I have a custom draw list box, I handle WM_DRAWITEM to draw the items but it seems that only the selected items are drawn. The others aren't being invalidated. Anyone know why?
cheers,
roel
|
|
|
|
|
Are you checking the item state and setting TextColor correctly? (DRAWITEMSTRUCT::itemState)
That's just a guess, without code it's hard to tell what's going wrong.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thanks for your reply, after letting it rest and getting some sleep it only took me 10 minutes to find it Problem was that I was using WTL's CDC and not CDCHandle, CDC destroys the DC when it goes out of scope... Argh stupid me, I've made this mistakes dozens of times for fonts and cursors and bitmaps, just when I thought that I wouldn't make it again this shows up... Anyway thanks for your answer.
|
|
|
|
|
I inserted on a form a Picture with a static control and the resource is a bmp image. I put background color when I drawed it at (255,0,255), but I set up the static control as transparent and it draws the background color.
How can make it transparent ?
Thankx !!
|
|
|
|
|
not sure i understand could you explain more
are you trying to draw a transparent bitmap ?
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
exactly. and I put it into a CStatic control as a Bitmap file so it shows it, but the (255,0,255) color in the BMP file doesn't turn to transparent when it is showed into the dialog.
Thankx !!
|
|
|
|
|
I am trying to develop an NT Service, novice in the field and running into following problems.
Let me simplify all the steps to explain problem i am facing, please let me know if i am doing anything wrong
I create a NT Service using Visual Studio 6 ATL Com wizard without a single line of my own code added here. Only thing i change is remove command from Project/Settings/Custom Build that re-registers the service. After that I compile the project. Let say name of the service is MyService. I use following commands to register and unregister service.
MyService -Service
.. start and stop the service
MyService -Unregserver
after this unregserver command this service goes in "Diabled" mode as shown in SCM and now if i want to re-register the service i can "Service cannot be deleted" message box. To only way to register the service again is to logoff the box.
Since I haven't added any of my code in this test project, there shouldn't be case of any dangling handle.
Any ideas?
|
|
|
|
|
It seems your service uninstall handler is not exiting the application after it DeleteService().
And also are you keeping SCM open while doing all these?
It's not a bug, it's an undocumented feature. suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Yes SCM is open while doing all this.
Since I didn't add any code myself in this case and just using wizard generated code, does this mean its a bug in the code that is generated by wizard?
Thanks for response anyway and appreciate any more comments.
|
|
|
|
|
I am having some difficulty and would like some view points on setting up the directory structure of projects that arent so small anymore.
Currently I have three parts to my project. The Core application and the Plugin are dialog based MFC programs.
1) Core Application
2) Common code
3) Plugin Framework
Each in a separate directory. The common code consists of utility functions, drawing routines, etc, which are shared between the core application and the Plugin Framework. One of my problems is that the MFC header file stdafx.h are all the includes for MFC stuff like CString. I don't want to hard code the path from the common directory back to my current project directory.
For example a file in the common directory needs to use CString but does not know what it is. I don't want to have to do this because I think it is bad technique.
#include "d:\project\stdafx.h"
I also don't want to do this
#ifdef CORE_APP
#include "d:\project1\stdafx.h"
#else
#include "d:\project2\stdafx.h"
#endif
As a result of moving all the files around I am now getting CString access violations and I am guessing it must have something to do with my poor file structure.
So what is a good approach for separating common files like in my situation?
Hope that made sense.
|
|
|
|
|
Use include directories? Just specify these in the properties.
|
|
|
|
|
I did add an include for the common folder but how do files in the common folder see the stdafx.h for example in the project directory or is that bad technique.
So, if I include #include "stdafx.h" the files in the common directory can't find this file (duh). I guess I could add a file in the common directory called includes.h and include anything that the common files need.
|
|
|
|
|
Access violations should have nothing to do with your file structure at all.
Are you using threads?
John
|
|
|
|
|
That's what I would of thought as well.
I am not using any threads. Well, I am using MSXML4 using smart pointers so I don't know what's going on in the background nevertheless the project was working just fine. I recently had a working project and decided that I wanted to clean up the code and reorganize the file structure. I added nothing new during this cleaning up process so it can't be anything I added.
I did things like:
Changed this from:
int A,R,G,B;
to this:
struct _Color
{
int A,R,G,B;
};
and
CString Fontname;
CString Fontstyle;
float Fontsize;
int A,R,G,B;
to
struct _Font
{
float Size;
CString Name, Style;
_Color Color;
};
I changed the way I included some of my file around and now the very first CString I get to I get the following error.
First-chance exception in HTPCCORE.exe (MFC42D.DLL): 0xC0000005: Access Violation.
crashing in the = operator
const CString& CString::operator=(const CString& stringSrc)
{
if (m_pchData != stringSrc.m_pchData)
{
crashs here-> if ((GetData()->nRefs < 0 && GetData() != _afxDataNil) ||
stringSrc.GetData()->nRefs < 0)
{
// actual copy necessary since one of the strings is locked
AssignCopy(stringSrc.GetData()->nDataLength, stringSrc.m_pchData);
}
else
{
// can just copy references around
Release();
ASSERT(stringSrc.GetData() != _afxDataNil);
m_pchData = stringSrc.m_pchData;
InterlockedIncrement(&GetData()->nRefs);
}
}
return *this;
}
Makes no sense.
If I were using threads what would the solution be. Oh, I am using VC++6 and I recently installed the latest service pack. Things were still working then as well.
|
|
|
|
|
My thoughts are that you did not initialize something in your first version properly but you were lucky that it did not cause a problem.
John
|
|
|
|
|
That may be the case. I started a new empty project and slowly added in all my files and checking for things like uninitialized variables. It works fine again. I really did not change much beside using a new empty project. Thanks for your responses.
|
|
|
|
|
smesser wrote:
So what is a good approach for separating common files like in my situation?
Exactly what you did. You can also seperate each part (execpt for the main application) into is own library or dll.
John
|
|
|
|
|
The plugin is a dll I need to learn how to put common into a dll. Can you point out a good article?
|
|
|
|
|
My help files are split in 4 .chm (one master, linking to others)... I want to search topic by ids without the user know that the topic doesn't come from the main .chm ?
I used
HtmlHelp(GetDesktopWindow(), HelpPath, HH_DISPLAY_TOC, id);
when I had only one .chm
but now I don't have an idea how to do the same!
thanks
|
|
|
|