|
I do it by creating a new bitmap the same size as an icon in the image list, do a FillRect() with the background colour, then Draw() the icon on it.
CBitmap *CMyImageList::GetBitmap(int index, CSize size, COLORREF clrBkGrnd)
{
int count = GetImageCount();
if (!(index < count && index >= 0))
return NULL;
IMAGEINFO info = {0};
GetImgeInfo(index, &info);
CSize ImageSize(info.rcImage.right - info.rcImage.left,
info.rcimage.bottom - info.rcImage.top);
int x = 0;
int y = 0;
if (size.cx != ImageSize.cx)
x = (size.cx - ImageSize.cx) / 2;
if (size.cy != ImageSize.cy)
y = (size.cy - ImageSize.cy) / 2;
CBitmap *pbmp = NULL;
CDC DC;
if (DC.CreateCompatibleDC(NULL))
{
int saved = DC.saveDC();
pbmp = new CBitmap;
if (pbmp)
{
if (pbmp->CreateCompatibleBitmap(NULL, size.cx, size.cy))
{
if (DC.SelectObject(pbmp))
{
DC.FillSilidRect(0, 0, size.cx, size.cy, clrBkGrnd);
Draw(&DC, index, CPoint(x, y), ILD_NORMAL);
}
}
}
DC.RestoreDC(saved);
}
return pbmp;
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hi, I have a simple dialog box app and would like to add a progress bar to it. The progress bar simply needs to move toward completion when a button is pressed. It needs to move toward completion based simply on a time, ie needs to be finished after the button is pressed in 5 seconds. Thanks for the help sorry i am such a noob. The progress bar ID i am using is OnOutofmemoryProgress2. Thanks.
|
|
|
|
|
add WM_TIMER functionality in your program suing winodow handller menu.
according to your calculation set the timer and using the Progressbar variable finsih it within 5 sec.
and by the way ->
The progress bar ID i am using is OnOutofmemoryProgress2. Thanks.
--> is not id,its a event on Progressbar and id is like this IDR_PROGRESSBAR1 or some thing like that.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
|
I'm interested in finding a method to verify the digital signature of a file so that I'll know if it's been altered since I signed it.
I looked at WinVerifyTrust(), but it only exists in NT/XP - not Win9x (which I still need to support).
Microsoft does however have a tool called ChkTrust.exe
Does anyone know "how" chktrust.exe works under win9x?
[ Jason De Arte | Toy Maker | 1001010.com ]
|
|
|
|
|
Well, after a few hours of digging and testing my theories - I've answered my own question. There's this thing called CAPICOM.DLL that provides a number of com interfaces for checking the authenticode signature on a file. And it even (as the rumor goes) have a redistributable for win98!
With a little work, I'm sure somebody with more time on their hands than I, could write up a full featured article that also Signs and timestamps a file.
#ifndef __SIGNED_CODE_H__
#define __SIGNED_CODE_H__
#import "capicom.dll" named_guids no_implementation
#pragma once
class CSignedCode
{
protected:
CComQIPtr<CAPICOM::ISignedCode> m_spSignedCode;
public:
CSignedCode(LPCTSTR pszFileName)
{
HRESULT hr = m_spSignedCode.CoCreateInstance(CAPICOM::CLSID_SignedCode);
if( SUCCEEDED(hr) && pszFileName && *pszFileName )
SetFileName( pszFileName );
}
HRESULT SetFileName( LPCTSTR pszFileName )
{
if( !m_spSignedCode )
return E_POINTER;
return m_spSignedCode->put_FileName( CComBSTR(pszFileName) );
}
HRESULT Verify(BOOL bAllowWindowsPromptUI)
{
if( !m_spSignedCode )
return E_POINTER;
return m_spSignedCode->raw_Verify(bAllowWindowsPromptUI?VARIANT_TRUE:VARIANT_FALSE);
}
HRESULT GetDescription(CString& rstrDescription)
{
if( !m_spSignedCode )
return E_POINTER;
CComBSTR bs;
HRESULT hr = m_spSignedCode->get_Description(&bs);
if( SUCCEEDED(hr) )
rstrDescription = bs;
return hr;
}
HRESULT GetURL(CString& rstrDescriptionURL)
{
if( !m_spSignedCode )
return E_POINTER;
CComBSTR bs;
HRESULT hr = m_spSignedCode->get_DescriptionURL(&bs);
if( SUCCEEDED(hr) )
rstrDescriptionURL = bs;
return hr;
}
HRESULT GetFileName(CString& rstrFileName)
{
if( !m_spSignedCode )
return E_POINTER;
CComBSTR bs;
HRESULT hr = m_spSignedCode->get_FileName(&bs);
if( SUCCEEDED(hr) )
rstrFileName = bs;
return hr;
}
};
#endif //__SIGNED_CODE_H__
[ Jason De Arte | Toy Maker | 1001010.com ]
|
|
|
|
|
Query:
I am building an MFC app. I try to open the resource file and I get a red circle icon with a white asterisk inside that says the "resource is open in another editor".
I then close all files (presumably) and restart. I get the same message from the resource. What's up w/ that? Nothing is "open"....
thanks
|
|
|
|
|
hi,
"resource is open in another editor" is coming when you already open the resource file.You can open the resource file twise.
thanks..
|
|
|
|
|
Hello. How can I do the following: when choosing some item from a popup menu (with a right button click) another popup is shown offering some things to do with that item. I don't need it to do classic way that is to use InsertMenu method with MF_POPUP flag but so that this additional menu is shown only on mouse click.
|
|
|
|
|
Handle WM_MENURBUTTONUP to know when the user r-clicks a menu. In response to that message, call TrackPopupMenu() again with the TPM_RECURSE flag.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but how will we fit the hamster inside the accordion?
|
|
|
|
|
|
Hi Dudes,
How to compile HTML files like we do in HTMLHelp Creation. Is there any SDK to do that.
Thanks & Regards,
Promise (hmmm... I am afraid of it).... Some times.
If you have in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
DELIVER THE PROMISE wrote:
Is there any SDK to do that.
Yes. Click here[^].
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi Bhavani,
Thanku very much.
I don't want to create HtmlHelp. But I want to compile Html files so that I can create an Ebook creation software. This software takes the HTML files as an input and produce an Ebook. I have to create such type of software.
Thanks for all that help.
Promise
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
am using the MFC Dialog Box project to make my program and i created another Dialog Box as my update window for the program am making.
so visual studo made the class created an object like
UDP UBox;
UBox.DoModal()
and it worked only problem is when i press Ok the update Dialog Box it close both Dialog Boxes how could i stop this i want the Dialog Box to stay open
|
|
|
|
|
Where do you call your DoModal?
<italic>Work hard and a bit of luck is the key to success.
|
|
|
|
|
in my
Onbutton_press
{
//here
}
|
|
|
|
|
You might have done something bad there
<italic>Work hard and a bit of luck is the key to success.
You don`t need to be genius, to be rich.
|
|
|
|
|
Hi !
I'm working to create a HTTP Server in C++, Win32API.
By now, it can be used by a remote client to retrieve an HTML/PHP file and it can translate the GET, HEAD and POST methods.
I've just a problem with PHP.exe : when I use a PHP page which call "session_start"... functions, a new session is created.
Somebody could help me to bypass this bug ?
|
|
|
|
|
tom87@21 wrote:
when I use a PHP page which call "session_start"... functions, a new session is created.
Looks like you're not passing the cookie for the existing session in your GET/POST request. Alternatively, your server may not be returning the session cookie to the client. If no (valid) session cookie is passed to the PHP page, a new session will be created.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
We have an MFC/Win32 application that is accessed by clients through a shared folder on the server. (similar to SourceSafe). Client computers usually have a mapped drive to the shared directory and have a shortcut to the application.
Client systems with XP Service Pack 2 installed now display a warning message box every time the application is about to be executed; the message box indicates that the application does not have a valid publisher certificate. This is understandable because of SP2's heightened security measures and the application is being "downloaded" from a network resource. My objective is to "remove" that warning.
Can anyone enlighten me on the process of validating/signing the application with a valid publisher certificate? From what I have read you need to acquire this from a Certificate Authority. I was under the impression before that this was usually reserved for things such as ActiveX controls or any executables designed to be deployed/used through the Internet.
Is there also a way to certify the executable without acquiring a certificate from a CA? I seem to have read that you can have a private certification server on your LAN to do this, I'm not sure (yet). Since it is an internal/LAN environment this might be more suitable, if possible.
This is quite new to me. Any help would be appreciated.
|
|
|
|
|
Hi, everyone
My question is simple:
How to create process in memory using winapi32 functions or any mrc code..
How to tell to the OS to launch new process from memory address I specify?
Thanks in advance!
|
|
|
|
|
Hi!
I am programing plug-ins for 3ds MAX and never deal with hardware earlier.
There is some 3D glove produced by www.essentialreality.com. So am going to write plug-in which enables users to work with this device inside the MAX.
So first question that appeares - how to reach this device and its output parameters.
I am downloadig SDK from essentionalreality site just now.
And hope it will help a. But this area is very new for me so any your help is essential.
Thanka a lot.
|
|
|
|
|
Most obviously the SDK already allows access to the device driver of the glove. This level of abstraction is useful as it provides means of getting data from the glove without worrying about the actual USB interface. The better the SDK is, the more lower level access it allows.
You should download the SDK and see it's documentation. I'm sure it will provide you with a good kickstart. I believe that the glove driver is primary emulating a mouse's behaviour in Windows (thus working automatically in 3DS Max)
It then depends on what you wish to do with the glove. Write the plug-in so that you can first use a mouse to do the things you please. Then take the glove into use, and see the SDK for any special properties it might have (such as 3D movement), and utilize them.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hello
Can anybody tell me how to subclass MessageBox ... particular I need to subclass 'OK' button or I want to change background color of one messagebox... Can anybody tell me how can do this ??
|
|
|
|