|
You could use CreateDialogIndirect to create the dialog window. It uses a template in memory in standard form but not neccessarily a resource identifier. Adding additional controls on the fly can be done with CreateWindow and specifying the appropriate class.
Not sure what you mean on your second question. There is very little difference in the dialog template between modal and modeless.
|
|
|
|
|
douglasjordan wrote:
CreateDialogIndirect to create the dialog win
Nice, I forget that api ... thanks
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hello, I wrote a function for drawing and resizing Bitmaps with VC++ 6 on Windows XP.
It works fine on Windows XP and Windows 2000. But when I try it on Windows NT4 Sp6 there is noching paited. I receive no errors and the created Bitmap Handle is not NULL. There just draws nothing on the screen.
I´m using the IPicture Interface for loading the Bitmap/jpg Files.
Does anyone have an idea where this might come from?
Do I need to update some dlls on the NT machine maybe some MFC dlls?
I´m rather new to Windows/MFC programming. So please excuse me if it´s a silly question.
-- modified at 4:33 Wednesday 28th September, 2005
|
|
|
|
|
After a lot of testing I narrowed down the problem. The Problem is not the Loading of the Bitmap. It is the resizing. Drawing the bitmap in its original size works fine.
Here is what I do:
LoadImageFromFile( &lbmpGraphic, fileName );
// lbmpGraphic contains the loaded bitmap (HBITMAP)
// this can be drawn on Windows NT
/*++++++++++++++ Begin Resizeing ++++++++++++++*/
// initialiZE Bitmap pointer
tempDC = CDC::FromHandle( GetDC( lhWnd ));
lpbmObject = new CBitmap;
// CREATE compatible Memory Devicecontext for the target
pCdcDest = new CDC;
pCdcDest->CreateCompatibleDC( tempDC );
// create compatible Memory Devicecontext for the source
pCdcSource = new CDC;
pCdcSource->CreateCompatibleDC( tempDC );
// Create compatible bitmap for the target dc
lpbmObject->CreateCompatibleBitmap( tempDC, lrectTarget.Width(), lrectTarget.Height() );
// Initialize target dc and save old bitmap
lpbmpDestSave = pCdcDest->SelectObject( lpbmObject );
// get bitmap Info for dimensions
GetObject (lbmpGraphic, sizeof (BITMAP), &lbmpTempBitmap);
// Select Bitmap into source DC
lpbmpSourceSave = pCdcSource->SelectObject(CBitmap::FromHandle(lbmpGraphic));
// Set stretchmode
SetStretchBltMode( pCdcDest->operator HDC(), COLORONCOLOR );
// StretchBlt Picture in Dest DC
lnStretchResult = pCdcDest->StretchBlt(
0,
0,
lrectTarget.Width(),
lrectTarget.Height(),
pCdcSource,
0,
0,
lbmpTempBitmap.bmWidth,
lbmpTempBitmap.bmHeight,
SRCCOPY );
if ( !lnStretchResult )
{
test_msg(ERROR, "ERROR in StretchBlt!");
}
// Draw a black frame
pCdcDest->LineTo(lrectTarget.Width() - 1, 0);
pCdcDest->LineTo(lrectTarget.Width() - 1, lrectTarget.Height() - 1);
pCdcDest->LineTo(0, lrectTarget.Height() - 1);
pCdcDest->LineTo(0, 0);
// get bitmap from target dc
lpbmpRes = pCdcDest->SelectObject(lpbmObject);
// make a copy ( lpoutBitmap stores the result of the function )
*lpoutBitmap = (HBITMAP)CopyImage(lpbmpRes->operator HBITMAP(),
IMAGE_BITMAP,0,0, LR_COPYRETURNORG);
//Cleanup
pCdcSource->SelectObject( lpbmpSourceSave );
pCdcDest->SelectObject( lpbmpDestSave );
tempDC->DeleteDC();
DeleteObject( lbmpGraphic );
pCdcDest->DeleteDC();
delete pCdcDest;
pCdcSource->DeleteDC();
delete pCdcSource;
lpbmObject->DeleteObject();
delete lpbmObject;
lpbmpRes->DeleteObject();
Something in this code does not work on NT. Maybe I deleted to much or to less objects or in the wrong order?
Does anyone have a suggestion?
Please help.
|
|
|
|
|
When I delete the last lines:
lpbmObject->DeleteObject();
delete lpbmObject;
lpbmpRes->DeleteObject();
The Bitmap will be drawn but I will leak 1 GDI Object each call. I can not have that.
btw I like talking to myself but it doesn´t help that much...
|
|
|
|
|
I am programming a Socket enabled with SSL on server side
//get the credentials
SecurityFunctionTable m_SecurityFunc;
Status = m_SecurityFunc.AcquireCredentialsHandle(
NULL,
UNISP_NAME,//schannel package requested
SECPKG_CRED_INBOUND,//for server
NULL,
&m_SchannelCred,//structure contains the data required for //SChannel
NULL,
NULL,
phCreds,//pointer to CreHandle which receives the handle to credentials
&tsExpiry);
if(Status != SEC_E_OK )
{
::OutputDebugString(_T("error"));
}
i m getting an error .I checked the returned value of status ,it is SEC_E_INTERNAL_ERROR
i m not understand where is the problem.
Thanx in advance for any suggestion
|
|
|
|
|
When you define a dialup or broadband internet connection on your computer a name is assigned to it. This name apears in the Control Panel-> Network Connections section . I want to know how can I get programmaticaly this names .
Can anyone help me?
|
|
|
|
|
USe the SetupDi functions to get the names. They are a pain in the arse to use mind you, you will need some sample code to help you. Look in the DDK, there is some code in it .
Nunc est bibendum
|
|
|
|
|
Radu Sorin wrote:
I want to know how can I get programmaticaly this names .
Can anyone help me?
I'm not sure of an API or a function that will retrieve the names, but you might could find them under the HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318} key.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hey,
A third party spyware has hooked onto some of the processes in my system. Is there a way I can unhook the dll without crashing the process.
Windows allows creation and deletion of hooks using SetWindowsHook and UnhookWindowsHookEx method. Hence a programmer can create a thread in any process by hooking onto it using one of these functions and then have that thread run....do whatever he wants and then later Unhook. In my case there is a DLL which has been loaded into a remote processes address space by a third party. I donot want that DLL there so I am trying to go into that processes address space and use FreeLibrary (Kernel32 call) to free that library and have the DLL unload. I can see the DLL unloading but for some reason the process crashes after a while. The process currently hooked is Winlogon and thus crashing it crashes my entire system.......
In short, having no handle what so ever to the hooked process (being a third party hook) is there a way I can unload that DLL without crashing the remote program ? Is there a way using FreeLibrary or any other way ???
|
|
|
|
|
the child window is a window derived from CScrollView
|
|
|
|
|
followait wrote:
the child window is a window derived from CScrollView
you have to manually notify the parent about Mouse Moving
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Can you add a message handler for the mouse move that posts back to the parent window?
|
|
|
|
|
I post a msg, it's ok, thanks.
|
|
|
|
|
How to write the program that when I type a data and send it through TCP/IP, it will add my own header infront of the data. I really need some help.
|
|
|
|
|
i'm a little confused by the question. Are you wanting to modify the standard TCP/IP header due to some special network protocol. That would require modification of the network layer of the stack.
If all you want is a header on your data due to an application layer protocol, that's easy. Just write a function to add you data to the end of a buffer which already contains the header you want. Hope that explains it.
- Marvin
|
|
|
|
|
Yes, what I want is a header on my data due to an application layer protocol.
|
|
|
|
|
Can someone please explain why the following does not work.
vector < std::ifstream > streams; // the declarartion is allowed
streams.resize(10); // but this fails to compile
vector < int > ints;
ints.resize(10); // this works as expected
I seem to remember having some problem with vectors of vectors in Visual Studio compiler, many moons ago, but don't recall the excact problem.
- Marvin
-- modified at 21:23 Tuesday 27th September, 2005
|
|
|
|
|
you should have template argument list, e.g, vector<int> streams
|
|
|
|
|
Sorry the syntax of my earlier post was a typo. The code that will not compile is as follows
I found out this web interface requires spaces after things like < and >.
vector < std::ifstream > streams; // this declaration compiles
streams.resize(10); // this does not
Thanks for the reply.
- Marvin
-- modified at 21:21 Tuesday 27th September, 2005
|
|
|
|
|
std::ifstream, this is unkown size, it's the reason.
|
|
|
|
|
very good, thanks.
- Marvin
|
|
|
|
|
no idea dude u might want to recheck the ints.resize(10)
-Code Shade
|
|
|
|
|
i found out this web interface requires spaces after < and >. That's weird, C++ doesn't freak-out like that. Anyway take a look again at my original syntax. there is nothing wrong with ints.resize(10); that works fine. the problem is streams.resize(10). it seems to be something odd about the type of objects which can be included in a vector.
- Marvin
|
|
|
|
|
ooo you proabably should have a template argument list like the other dude said. if you get the answer send it to me if you can at this email shade444@mail.com thanks
-Code Shade
|
|
|
|