|
hi,
I'm trying to gain access to a 16-bit app.
i'm trying something like :
::readProcessMemory(ProcHandle, (LPVOID)OffSet, buffer, BytesToRead, &BytesRead);
this doesn't work.
I did some research and it seems that all 16-bit apps operate in the same address space.
Well, ... I found a DLL (toolhelp.dll) with which I can get the Job done but only in WIN9x.
I need something to get the job done under NT too.
preferably I'm looking for a way that works equally good in all environments.
thx & greetz
I used to have a life ... now I have a computer
|
|
|
|
|
Help,
I'm trying to launch a new IE instance from a CHtmlView based SDI application.
The code is as follows:
CWinApp* pApp = AfxGetApp();
CDocTemplate* pDocTemplate;
POSITION pos = pApp->GetFirstDocTemplatePosition();
pDocTemplate = pApp->GetNextDocTemplate(pos);
CDocument* pDoc = pDocTemplate->CreateNewDocument();
CFrameWnd* pNewFrame = pDocTemplate->CreateNewFrame(pDoc/ *GetDocument()* /,
NULL/ *(CFrameWnd*)AfxGetMainWnd()* /);
pDocTemplate->InitialUpdateFrame(pNewFrame, NULL);
CPeachPlorerView* pView = (CPeachPlorerView*)pNewFrame->GetActiveView();
pView->SetRegisterAsBrowser(TRUE);
*ppDisp = pView->GetApplication();
Unfortunately the new frame is parented to the previous one. I think the CDocTemplate framework inherit the same CWinApp. So when I close the parent the child is closed to.
The best way would be to launch a new instance of my application, and keep a handle on it so that I can pass the IDispatch interface (ppDisp). I mean initializing the SDI from another. I've no idea on how to do this. Can somebody help me ?
Yarp
|
|
|
|
|
What is the Win32 API equivalent of MFC's ModifyStyle ?
rechi
|
|
|
|
|
LONG lStylesRemove;
LONG lStylesAdd;
LONG lStyle = ::GetWindowLong(hWnd, <FLAGS>);
lStyle &= ~lStylesRemove;
lStyle |= lStylesAdd;
::SetWindowLong(hWnd, lStyle);
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
OK, .
What about ModifyStyleEx ? I had problems once trying the way you wrote above.
rechi
|
|
|
|
|
First off I made a mistake in the way that I called GetWindowLong. It should be called like this
::GetWindowLong(hWnd, GWL_STYLE);
and SetWindowLong like this:
::SetWindowLong(hWnd, GWL_STYLE, lStyle);
As far as the Ex styles, it should work exactly the same except that you will use the GWL_EXSTYLE flag instead.
THere is however one thing that I just thought of, if you are modifying a style that deals with the window frame, you will need to make a call to SetWindowPos in order to force the window to incorporate the new style changes into your window.
I found the code directly out of the ModifySTyle function in MFC, here is how they do it.
ASSERT(hWnd != NULL);
DWORD dwStyle = ::GetWindowLong(hWnd, nStyleOffset);
DWORD dwNewStyle = (dwStyle & ~dwRemove) | dwAdd;
if (dwStyle == dwNewStyle)
return FALSE;
::SetWindowLong(hWnd, nStyleOffset, dwNewStyle);
if (nFlags != 0)
{
::SetWindowPos(hWnd, NULL, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | nFlags);
}
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I loaded a project I brought in from home into VS at work and it says classview info isnt accessible so classsview pane is unpopulated. Its not read only or anything...
Help! I need the class info.
|
|
|
|
|
just delete the .clw ,.aps,.npc from your workspace folder and open the workpace agin that will work.
Renjith-CPian.
|
|
|
|
|
Thanks so much! This problem has been so pesky! Appreciate it,
ns
|
|
|
|
|
I'm making a standard MFC app with one dialog. On the dialog I have placed 2 radio buttons. When I run my program none of the radio buttons is checked. How do I make one of the default checked when I start my program?
|
|
|
|
|
Do you have a member variable set up to handle the radio buttons (through ClassWizard)? If so, in your constructor, set it to 0 or 1 in the class constructor (depending on which radio button you want checked.)
If not, you need to set up control classes for each radio button, and in the OnInitDialog function, call:
yourButtonObject.SetCheck(1);
for the button you want to have checked.
Even if you win the rat race, you're still a rat.
|
|
|
|
|
make a contol variable and control variable.SetCheck(1);
Renjith-CPian.
|
|
|
|
|
Hello all,
I would like to simulate the mouse clicking and selecting commands. Basically, if I press a button in a toolbar, I want it's function to run. For instance the "New" button, or the "Open" button in the Word toolbar, will obviously create a new file, or open a selected a file.
What I would like to do, is know how to send a message saying "I clicked on a Toolbar button!" to the project.
I'd also like to know ho to do this from the DropDown Menu. I'd liek to be able to say I selected a Drop Down Menu command without doing any of the selecting the command from the drop down menu (call me lazy, hehehhehhe).
If anybody knows how to do this, that'd be cool if they could show me how or show me where I could learn,
Thanks a bunch
|
|
|
|
|
Greetings...
I have custom draw treeview control. I am able to change the default color of the treeview by using the following code :
case NM_CUSTOMDRAW :
case CDDS_CUSTOMDRAW:
return CDDS_ITEMPAINT:
case CDDS_ITEMPAINT:
/*
changing the color of the text here
*/
How can I trap the drawing of the checkbox so that i can chage the color in which the check box is drawn ?
Please help...
Ritesh
|
|
|
|
|
insanely420 wrote:
How can I trap the drawing of the checkbox so that i can chage the color in which the check box is drawn ?
Why bother? Just draw some nice looking checkbox icons or bitmaps & put them in the tree's state item image list (TVSIL_STATE ). That's where the default ones come from
Shog9
--
Maybe Java is kind of like God, it "works in mysterious ways". It seems like your apps are running slowly, because in the backgroud Java is solving world hunger, or finding the cure to cancer.
- Ryan Johnston, Don't die java!
|
|
|
|
|
I did a destroy WIndow on a view from another view. Well, the view didnt vanish like i thought it would. But if I dragged view1 over it, it made a big white area where view2 was. I tried invalidate() but thats not it.. Shouldnt view2 have vanished? WHat should I do to make it vanish?
Thanks,
ns
|
|
|
|
|
here's the code, when i get to the GetOpenFileName line it gives me an unhandled exception, i can't figure out what's wrong, here's the code:
void OnBrowse()
{
OPENFILENAME ofn;
char szFileName[MAX_PATH+1];
const char szFilter[] = "All Files (*.*)\0" "*.*\0";
szFileName[0] = '\0';
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = ghWnd;
ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = (LPSTR)NULL;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFileName;
ofn.nMaxFile = sizeof(szFileName);
ofn.lpstrFileTitle = NULL;
ofn.lpstrTitle = (LPSTR)NULL;
ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_EXPLORER;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = "txt";
if (GetOpenFileName(&ofn))
SetDlgItemText(ghWnd, IDC_LIST, szFileName);
}
Thanks in advance.
-Rune Svendsen
|
|
|
|
|
A couple of points I can see from looking at the documentation for GetOpenFileName() .
- What operating system are you using? There's a note in the platform SDK documentation that says:
"lStructSize Specifies the length, in bytes, of the structure.
Windows NT 4.0: In an application that is compiled with WINVER and _WIN32_WINNT >= 0x0500, use OPENFILENAME_SIZE_VERSION_400 for this member.
Windows 2000/XP: Use sizeof (OPENFILENAME) for this parameter."
- This is more likely to be the problem - you've forgotten
lpstrInitialDir . It should either be the directory you want the dialog to start in, or NULL.
Hope that helps!
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Thanks, it was the lpstrInitialDir.
|
|
|
|
|
Can someone give me some clues on how I can do the following things, eg what sort of messages I need to be overriding.
- I have an MDI app. When the MDI frame is loaded, I load a modeless dialog box acting as a toolbox. Id like to be able to drag things from this toolbox onto the view.
- Once things are dragged onto the (CView derived) view, id like to be able to drag them around, and possibly be able to link them up, eg when i ricght click on one of the nodes a line is extended, and when this is released on top of another node, things happen in the document.
Ive never been able to get much use out of Spyy++.
|
|
|
|
|
Spy++ won't help you. You need to define classes to describe the objects you want to drag and drop, then you need a container in which to store them so you can draw the ones that are already there, and select them to move them.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
I want to keep all the urls to whome users navigated for this purpose I have to implement the DWebBrowserEvents2 (sinking interface) in my ATL COM based dll but I do not exactly know how to write that dll and to advice internet explorer to call that function on event firing if some one know then tell me or guid me on this problem I will be very much thankful
Waiting for your cool comments
|
|
|
|
|
i need to drop buttons on a CToolBar, but state of the CToolBar is very strange:
the tool bar has multi-buttons, i.e. 5 in 2 rows.
when drop a button (use InsertButton function) on it, an original button dispears (just can not see, but it is there) and new button is on, add one more, toolbar becomes 3 rows, and so on.
anyway, i can see only 5 buttons.
if double click, bar goes docked, all buttons apear! double click again, all buttons are still there.
it means i need to refresh tool bar after drop a button on it.
i call RecalLayout, Invalidate, RedrawWindow, AutoSize ... and all functions i can find, but no luck
please help
includeh10
|
|
|
|
|
Hi all,
According to MSDN, CDC::DrawText will not alter the width of the CRect given to it when there are multiple lines of text and DT_CALCRECT is specified, only the height. Is this information correct, and if so what is the correct way to specify multiple lines of text? I have my text in a CString object, and I'm trying to break text into lines by sticking \n in appropriate places but the width (i.e. my CRect::right ) is being altered, is this not the correct way to separate lines?
If it is the correct way, is there some magic trick I need to do with the DC to stop DrawText from playing with CDC::right ? I've done:
pDC->SetTextAlign(TA_LEFT | TA_TOP);
pDC->SelectObject(m_FontMain);
The bad code:
pDC->DrawText(strComm, rcComm, DT_CALCRECT | DT_WORDBREAK | DT_LEFT | DT_NOPREFIX);
Dylan Kenneally
London, UK
|
|
|
|
|
I think that you are on the right track, however if you look at the description for the DT_WORDBREAK flag this is what it says:
Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-line feed sequence also breaks the line.
So I would try using "\r\n" to insert line breaks rather than just "\n".
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|