|
Hi,
How can i get a bitmap buffer from a .dib file?
Neha
|
|
|
|
|
Look in the code of the IconPro sample from Platform SDK. There is a file that is working with DIBs (dib.c)
Also look here in this article: DibSection
And, you can find a lot of info in "Bitmaps and Palettes" section here, on CodeProject
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Thanks for the reply.
But i feel .dib &.bmp are same in windows.
If i write
HANDLE hImage = ::LoadImage (AfxGetInstanceHandle(), "d:\\winnt\\prescan3.BMP", IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE );
I will hImage as NULL.
Why is it so?
|
|
|
|
|
Try to put NULL instead of AfxGetInstanceHandle()
This should help, cause when you are loading from file you do not need the Instance handle
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
It works with all other bmp file.But it doesn't work with the file which i renamed from .dib to .bmp.
Any idea?
|
|
|
|
|
Did you try to open the file with other utilities? Such an IrfanView, or simple Word?
And if you can, can you send me that .dib file, so I'll play with it?
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Also, look at DIBLOOK sample in your MSDN. This project supposed to open DIB files as well as BMP file. If it is not, so your .dib is corrupted
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Explanation,
I have some code that runs in a toplevel windows position,
This code never-the less appears to get infected and corrupted by virri on occasions.
So I do a couple of CRC checks on the apps initiation to verify if the existing code is also infected.
for-example:
if( code_infected() ) { Error_message(); Exit(); }
else RunTheApp();
Ok simple enough eh!
My question is how can I detect what was the malware/nasty that infected my App ?
Note all the code is in one exe.
I could spawn a process that monitors the app, but this would be liable to be infected as well.
Any help welcome ! Thanks.
Regardz
Colin J Davies
Sonork ID 100.9197:ColinI live in Bob's HungOut now
A good example of "Fully Managed" coding
|
|
|
|
|
Look for CheckSumMappedFile() in your MSDN. You'll find there all about executable files images
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
There's an unused field in the PE header that you can use to store a checksum of the file. You would use or write a checksumming program and run that on your app, and that program would store the checksum in the PE header. Then your code_infected() routine would use the same algorithm to compute the checksum and compare the two.
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
What if it's a smart virii that modifies the checksum field?
Todd Smith
|
|
|
|
|
A virus that analyzes the host program, locates the checksumming algorithm, runs it against itself, and saves & verifies a new checksum? Not likely.
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Well, what if the target application is a crack program. Then it would be very very easy to crack the program.
I think Colin is trying to protect an application from the crackers. If so, you should choose a third-party library. Here is a good one.http://www.bit-arts.com/ It is really expensive, but if you use ChargeKey service to sell your software, they provide these programs for free. Have a look at it.
Kind regards
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
|
|
|
|
|
I have a procedure in sybase which has to be executed
in frontend thru VC++...So, how do u go abt it...! Right now i
have used DBGrid Control to access my info in the frontend...as per my understanding...!Or is there any other way to spool the info of the stored procedure....?I just have to see the data in the stored procedure ,excuted in the front end...!
plz help
S
|
|
|
|
|
I re-worked one of my functions today and for some reason, all of the new variables that I create share the same address and, therefore, share the same data. It's causing some issues with the handling of the application and I've never seen anything like this before. Does anyone have any ideas as to how this could happen or how I could fix it?
|
|
|
|
|
Post the code here, so someone will answer more correctly.
It is something in your code, check assignments. Also are this variables pointers or not?
IS, post the code here
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Here is the code:
CString OffensiveBackfield;
if (true)
{
int ItemIndex;
CString Subheading;
CString SubheadingNumber;
bool SubheadingAdded = false;
//Populate the dialog item drop down lists with the position names
NumFormations = pApp->GetProfileInt("Offensive Backfield Formations\\Formations", "NumFormations", 0);
if (NumFormations > 0)
{
for (int j = 3; j < 6; j++)
{
for (i = 1; i <= NumFormations; i++)
{
_itoa( i, buffer, 10 );
FormationRegName = pApp->GetProfileString("Offensive Backfield Formations\\Formations", "Formation" + (CString)buffer);
NumReceivers = pApp->GetProfileInt("Offensive Backfield Formations\\Formations", "WR" + (CString)buffer, 0);
if (NumReceivers == j)
{
if (!SubheadingAdded)
{
_itoa(j, SubheadingNumber.GetBuffer(0), 10);
strcat(SubheadingNumber.GetBuffer(0), " Wide Receivers");
Subheading = SubheadingNumber;
ItemIndex = pOffensiveBackfieldBox->AddString(Subheading);
pOffensiveBackfieldBox->SetItemData(ItemIndex, 0);
SubheadingAdded = true;
}
TildeCheck = FormationRegName.Find(" ~ ");
if (TildeCheck != -1)
{
FormationName = FormationRegName.Left(TildeCheck);
}
else
{
FormationName = FormationRegName;
}
ItemIndex = pOffensiveBackfieldBox->AddString(FormationName);
pOffensiveBackfieldBox->SetItemData(ItemIndex, 1);
}
}
SubheadingAdded = false;
}
}
}
if(OffensiveBackfield != "")
{
pOffensiveBackfieldBox->SelectString(0, OffensiveBackfield);
}
For some reason, the variables "Subheading", "SubheadingNumber", and "OffensiveBackfield" all have the same address associated with them. After the line "_itoa(j, SubheadingNumber.GetBuffer(0), 10);", all three of the variables have the same data in them. This is not how it should be and I'm wondering how this is happening.
|
|
|
|
|
Stew wrote:
_itoa(j, SubheadingNumber.GetBuffer(0), 10);
strcat(SubheadingNumber.GetBuffer(0), " Wide Receivers");
You have two problems there. First, you're allocating a buffer of length 0, so the _itoa() and strcat() calls are overrunning the buffer. Second, you're not calling ReleaseBuffer(). Do something like:
LPTSTR pszBuff = SubheadingNumber.GetBuffer(16);
_itoa ( j, pszBuff, 10 );
SubheadingNumber.ReleaseBuffer();
SubheadingNumber += _T(" Wide Receivers");
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Oh, I'm late, LMAO, Well, Michael told ya already
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
Can someone help me with a demo project? I have two (2) edit boxes. When I type something in one edit box I want the other edit box to instantaneously update. However, if I keep typing information, new information is typed on top of old information. It looks awful. I tried
m_edit0 = name;
GetDlgItem(IDC_EDIT0)->Invalidate();
GetDlgItem(IDC_EDIT0)->UpdateWindow();
and alot of other things, but nothing makes it work correctly. Please, please, can I email a demo project that illustrates this error and hopefully, someone will be able to help me fix it?
My email address is brinasas@yahoo.com
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
Hi Danielle,
Just try follows:
GetDlgItem(IDC_EDIT0)->RedrawWindow();
Should help!
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
I have a ComboBox on my Dialog. I want to put items in it that aren't supposed to change so i open its properties and i type in the items seperated by CTRL+RETURN which takes me to the next line. For some reason the items dont show in the ComboBox when i run the dialog. (the dialog is called from another dialog with DoModal() ).
Can anyone think of a reason why the items wont show???? (i tried all different combinations of the properties, i tried changing the style and Owner draw and everything else so its not that)
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Maybe you are calling ResetContent() somewhere in your OnInitDialog() ?
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|
|
How do I access a MFC ActiveX .OCX interface in VC that was created in VC?
Thanks in advance...
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
Assuming that CLSID_ISomeInterface is the class id of interface you want to access, so the code of getting it should be like this:
ISomeInterface* pInterface = NULL;
CoCreateInstance(CLSID_ISomeInterface, NULL, CLSCTX_INPROC_SERVER,
IID_ISomeInterface, (void**)&pInterface );
the pInterface will contain your interface.
But the code can be different for different ActiveXs. If you want to know exactly, tell what interface you want to access.
Philip Patrick
"Two beer or not two beer?" (Shakesbeer)
Web-site: www.saintopatrick.com
|
|
|
|