|
Actually that does happen.
But only on the first slider on the dialog. For some reason the other sliders will not accept the first message. I say the first because if you click it twice then it starts working.
Mark
|
|
|
|
|
I tested your code.
I can't move any trackbars until I click on the cancel button but drag the cursor off it before
releasing - that releases capture from the dialog. Then I can drag a trackbar thumb.
I think the PreTranslateMessage() needs to really only pass certain mouse messages to the child
under the cursor, not all messages. I would guess that WM_SETFOCUS and WM_PAINT, at the very
least, are going to be a problem in the current implementation.
I'm still playing with it but I'm about to be interrupted for dinner.
I shall return.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks Mark for looking into this. I was just trying to build on some existing code not realizing I would have so much trouble.
I've got a deadline I need to meet so I'm just going to put a tool window on the dialog and the user can close it when they are done.
Later I might come back to this or just create a CWnd that contains the sliders and don't use the DoModel().
So many ways too do something.
Thanks again
Mark
|
|
|
|
|
Oh it's modal too? I was testing modeless
There should be an easier alternative with a modeless dialog. You can use focus or activate
messages to close the dialog when the user leaves it.
Good luck!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have a dll that runs two functions:
One is to disable the USB porst....
TWO is to change the WinLogon keys: DefaultUserName and DefaultPassword.
These two functions use the LogonUser function that I pass the administrators account. It does not works fine the first time executing like this.
USB
WINLOG AS LIMMITED ACCOUNT
Everytime I try to LogonUser the user after executing the second function it gives me an error: Uknown user name or bad password.
Everytime I do it I use administrator's account.
Any help will be greatly appreciated.
Regards,
Jose
|
|
|
|
|
I have written some code which injects a DLL into another process, in order to add a new menu item into the process's window menu. However, once I inject the DLL into the process, I'm not sure how to find out the window handle of the process which I've injected the DLL into - and this code needs to be executed within the DLL, as I am using SetWindowLongPtr() with GWLP_WNDPROC so that I can monitor the window messages to find out when the menu item has been selected. Also note that this DLL is intended to be injected into all the visible running processes and add the menu item to each process's main window.
Thank you for your help
-- PerspX
|
|
|
|
|
Try something like this...
<br />
VOID SomeClass::EnumerateWindows()<br />
{<br />
EnumWindows(EnumWindowsProc,0);<br />
}<br />
<br />
BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)<br />
{<br />
DWORD dwPID = 0;<br />
GetWindowThreadProcessId(hWnd,&dwPID);<br />
}<br />
A window is the 'main' window of a process if it has no Hwnd parent within same PID. But keep in mind... some processes can have multiple 'main' windows (such as Outlook). A more correct term to describe these windows are 'Top level windows'
Good Luck,
-Randor (David Delaune)
|
|
|
|
|
Thanks - it works really well and to find out which process owns the DLL, I just compare the result from GetWindowThreadProcessId() with the PID from GetCurrentProcessId()
--Perspex
|
|
|
|
|
Hello
When i use VS6 to write winsock apps, they run normally, but when i try to debug them, i reach the line that initializes the socket :
sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
or whatever
and when i press F10 to step over it, i get a runtime error:
First-chance exception in UdpTest.exe (NTDLL.DLL): 0xC0000008: Invalid Handle.
i tried lots of source codes from lots of sites
i have WinXP Pro SP2
Can anybody help me plz
Thanks in advance
|
|
|
|
|
Have you called WSAStartup() before using any Winsock APIs?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
yes i did
here's the line
if (WSAStartup(MAKEWORD(2,2), &data) != 0) return(0);
|
|
|
|
|
After re-reading your post...does an unhandled exception actually occur or do you just see
the first-chance message in the debug output?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
not in the output .
A pop-up message comes out saying first chance exception ...
then it takes me to assembly window.
|
|
|
|
|
Oh maybe you have your debugger set to break when an exception is thrown instead of continue.
If you continue executing (ignore the break) and the app continues running then everything is
fine - the exception was handled in the DLL.
If you get an unhandled exception after continuing, then that needs to be addressed
(obviously ).
See What is a First Chance Exception?[^]
and
How to Stop on First Chance Exceptions - Visual Studio .NET 2003[^]
First chance exceptions are ok if handled - I don't think we get a second chance
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
It means you've passed an invalid HANDLE to some API. For example:
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HANDLE hBad = reinterpret_cast<HANDLE>(0xBAADF00D);
CloseHandle(hBad);
return 0;
}
Steve
|
|
|
|
|
When deriving from CWnd, is there a way to effectively hide CWnd::Create from showing up in things like intellisense? CEdit, CButton, etc... all do this but I fail to see how they are doing it in the MFC source code.
I'm trying to bury the window class registration stuff inside the class in a static sort of way and I can't seem to figure out how to hide CWnd::Create.
Does anybody know how to do this?
|
|
|
|
|
hello..... I have my code like this ....but I want to write my xml in a file like "Results.xml".......please help me.... ..how can i give the path?
#using "System.Xml.dll"
using namespace System;
using namespace System::IO;
using namespace System::Xml;
int main()
{
//Create a writer to write XML to the console.
XmlTextWriter^ writer = nullptr;
writer = gcnew XmlTextWriter( Console::Out );
//Use indentation for readability.
writer->Formatting = Formatting::Indented;
writer->Indentation = 4;
//Write an element (this one is the root).
writer->WriteStartElement( "book" );
//Write the title element.
writer->WriteStartElement( "title" );
writer->WriteString( "Pride And Prejudice" );
writer->WriteEndElement();
//Write the close tag for the root element.
writer->WriteEndElement();
//Write the XML to file and close the writer.
writer->Close();
}
|
|
|
|
|
This is managed code, not C++. Please use the appropriate forum[^] (and use the formating tags when you post code).
|
|
|
|
|
lavy2883 wrote: want to write my xml in a file like "Results.xml".......
Use the constructor in your previous post - the one that takes a String^ and an Encoding^.
writer = gcnew XmlTextWriter("C:\\Results.xml" , Encoding::UTF8 );
...
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: writer = gcnew XmlTextWriter("C:\\Results.xml" , Encoding::UTF8 );
A managed code on the C++ forum
|
|
|
|
|
WhiteSky wrote: A managed code on the C++ forum
Yeah Yeah.
I mix managed C++ code with MFC code - where should I post my questions?
I know the answer
Frankly, I'm just lazy - I'd rather type a possible solution then explain the proper forum.
In this case I didn't even think about it - looked like C++ to me!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hello all,
I need to translate an application to a language that uses a special character set.
I need to show special characters from that special character set in my CStatics and other controls.
How should I do that?
I can imagine that using unicode I will be able to use them, but I still don't get how to write those texts.
As always thank you in advance.
|
|
|
|
|
Joan Murt wrote: I need to show special characters from that special character set
By "special character set" do you mean "font"? If so, then simply select the font by calling SetFont() on the static control.
|
|
|
|
|
Hello Hans,
I do not mean that, I use the character set of the Spanish language, and I want to use special characters like AE (a letter that has the A and E joined) and other ones used in Danish.
But anyway, thank you for your feedback.
|
|
|
|
|
To start with you need to compile with UNICODE
led mike
|
|
|
|