|
I've tried to look for help here on Codeproject and elsewhere but the only pages I found are ones to automate opening an image and displaying it but I need to do something a little different. I have a valid bitmap image file, however, I also have bitmap data stored elsewhere. Is there a way I can display the bitmap using the data stored elsewhere but use the former valid bitmap images' header and palette data to display with. I tried inspecting some data types to simply display the bitmap but I can't find an obvious way to intercept the loading and simply point a pointer to the new area in memory where the data exists.
I know I could simply write the header to a new file followed by the new data and show that but I'd like to leave less of a footprint behind and streamline the process. Thanks in advance for any help you can give, Nate.
Edit: I guess I never really can find out a good explanation as to what each command does in order to display an image. Too many sites are interested in just telling you how to do it, instead of explaining how to do it; I guess programmers are in that much of a hurry.
|
|
|
|
|
I have an application which uses shared memory, but when I tried to modify this application (which has a different shared memory structure), I keep getting the the old shared memory names.
At run-time if I set a breakpoint an examine the shared memory pointer is has the new data structure. However when I examine the pointer during edit is contains the old memory names.
BUT I cant set data to either the old or new names.
Can I clear out the old names, or am I going mad?!?
I have searched for the old names and they are not present in the project.
grahamfff
|
|
|
|
|
Apparently the Visual Studio 2003 debugger sometimes has trouble keeping up with what's happening in memory. I was trying to do some Interop via C++ Managed Extensions to some legacy code (unmanaged) that allocates an object and returns a pointer to it. While stepping through in the debugger it appears that the data is not returned, when in fact it is. If you build and run the following code, put in a breakpoint where indicated and try to look at what pData points to, it will appear to be undefined, but in fact it is there.
(GetData2() shows it properly, it is effected by what should be a superfluous "new"; if anyone knows that something else is going on, please tell me. Thanks.)
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#include <time.h>
#pragma unmanaged
class CData
{
public:
int nId;
int nData;
CData()
{
nId = time(0);
nData = 14;
}
};
class DataAccess
{
public:
void ReadData(CData ** data)
{
CData *pUnmanData = new CData();
*data = pUnmanData;
}
};
#pragma managed
using namespace System;
using namespace System::Threading;
using namespace System::Runtime::InteropServices;
[CLSCompliant(true)]
public __gc class Data_Managed
{
public:
int nId_Managed;
void GetData()
{
DataAccess dataAccess;
CData *pData;
//pData = NULL;
dataAccess.ReadData(&pData);
nId_Managed = pData->nId; // Put Break Point Here <<<<<<
}
void GetData2()
{
DataAccess dataAccess;
CData *pData;
pData = new CData();
dataAccess.ReadData(&pData);
nId_Managed = pData->nId;
}
};
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
// TODO: Please replace the sample code below with your own.
Console::WriteLine(S"Hello World");
Data_Managed * data_Managed;
data_Managed = new Data_Managed();
data_Managed->GetData();
Console::Write(S"Id= " );
Console::WriteLine( data_Managed->nId_Managed.ToString() );
data_Managed->GetData2();
Console::Write(S"Id= " );
Console::WriteLine( data_Managed->nId_Managed.ToString() );
return 0;
}
-- Chip Patton
|
|
|
|
|
Hi,
I am writing driver installation program for a system with no mouse.
So I need install the microsoft HID class programatically before doing my installation since my installation requires HID class. Since there in no mouse or any usb devices attached to the system, I have to manually install HID class to load the sys files into system32 folder. I know we can use the func UpdateDriversForPlugandPlay()...I dont how to set the parameters.
Any one have any ideas how to do this..pls help..
Thanks a lot in advance.
|
|
|
|
|
I have a unique project I am trying to accomplish. I have a right-click menu that has several items. This is an existing application so AppendMenu is used for most of the elements. I would like to add one additional elements, called "Select File...", which is actually a popup menu to a submenu. This submenu has to be dynamic to where it reads a directory and lists all the files in that directory. The purpose is to allow a user to select the file he/she chooses and launch an editor.
In researching my project, I have the code to read and list the files. My problem is as follows: how do I capture the menu item that the user selected? In the existing structure, the AppendMenu consists of ID values so in the WM_COMMAND for the window, the ID can be captured. I cannot accomplish my task in the same manner since the # of files can vary. I was planning on using by position but how do I capture the menu item after the user has clicked on it? Maybe I am making this more complicated than it should be???
|
|
|
|
|
You could reserve an id range starting with a known base (eg: IDC_EDIT_FILE_0 ) and use the offset into your file list to compute the popup menu's command id. The handler for menu commands in the range would then compute the index into the file collection and cause the appropriate file to be processed. I'm guessing this is how MFC's MRU support is implemented.
One downside is you can't process file collections outside the range, so you'd need to select a reasonably high upper limit.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
That is kind of how I am presently implemented it. I am reading through the directory, for each value, I am assigning a MenuItemInfo, then doing a SetMenuItemInfo, followed by the InsertMenuItem. I am doing this since I need to be able to retrieve the appropriate filename. I am using BASE_ID_VALUE+nIndex, where nIndex starts at 0 and I keep adding 1 to it. I have attempted to put code in the WM_COMMAND but I can never seem to capture the command to the menu. If I change the code to use AppendMenu, it seems I can capture the message in the WM_COMMAND but I am not sure how to get the filename associated with the menu item clicked. Any ideas on how I can capture the WM_COMMAND message after the user has clicked on one of the filenames?
|
|
|
|
|
Use the ON_COMMAND_RANGE macro to this. You'll need to reserve 2 command ids, one for each end point of the range.
ON_COMMAND_RANGE (CMD_OPEN_FILE_0, CMD_OPEN_FILE_1024, OnOpenFile)
You'll also need to keep the file list around during the execution of the command.
Alternatively, if you're calling TrackPopupMenu() , use the TPM_RETURNCMD flag to retrieve the selected command id. Then, compute the selected filename and just call an api to do your bidding.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Try CCmdUI interface for that menu command. In ClassWizzard you actually have 2 messages for a menu_item: ON_ID_menu_item:COMMAND and ON_ID_menu_item:UPDATE_COMMAND_UI. Use the second one for the purpose you face to.
|
|
|
|
|
Alrightie, we're displaying a stream of html text in our CHTMLView, but we've come up with a "quirk".
The html code we're using contains #links to other spots in the same body of text. When the user clicks the links, the html view displays the following instead of moving the page to the desire spot:
"blank#LINK_NAME"
where link name is the name of our link.
Is there a way to make this work like it does in the browser? My guess is that there's no file name associated with the document, and that's why it doesn't work.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Would it be possible to override CHtmlView::OnBeforeNavigate2() and replace BLANK# present in the url with just # ? I'm hoping this will cause the embedded browser to simply scroll to the link.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I had a similar problem once. Ended up writing my own Async Pluggable Protocol which did the trick. There is an example from Microsoft available there somewhere called db-2-xml which demonstrates this technique.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
I have changed the text and background colours of CEdit's in dialog boxes in the past by overriding OnCtlColor. Now I'm trying to do the same thing with a CEdit in a Control Bar. I thought I would be able to override OnCtlColor in CMainFrame but I'm having trouble getting this to work. CMainFrame doesn't seem to receive the WM_CTLCOLOR messsages, although it receives and successfully handles many other messages from the bar .
I attached the dialog bar to the CMainFrame in OnCreate like this:
m_MessagesDlgBar.Create(this, IDD_MESSAGES, CBRS_BOTTOM, IDD_MESSAGES);
Does anyone know where I'm going wrong? Any assistance would be gratefully received.
Best Regards
Cliff Hatch
|
|
|
|
|
VS 2003
I created a dialog bar using the instructions in this article: (minus the InitDialog addition)
http://support.microsoft.com/default.aspx?scid=kb;en-us;185672
then added a WM_CTLCOLOR handler from within the CDialogBar derived class. Worked fine for me.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Thanks Jack.
It works fine for me too
I have some other dialog bars that I will be able to convert usefully in this manner, to reduce the clutter in CMainFrame.
Best Regards
Cliff
|
|
|
|
|
Compiler: VC6 SP5
OS: Windows XP
I have a program that uses CustomDraw on list controls. Everything works until I add a .manifest file to turn on XP styles. When the .manifest file is in place I get the new look fine except on the list controls. On those I frequently get blank lines.
Any suggestions?
|
|
|
|
|
I'm using Microsoft Visual C++ .NET Standard Edition (2003) on Windows XP.
I just want to create a few console applications to test a few things out, but I can't seem to work out how to add a plain simple .cpp or .h file to a project, or even just open a fresh .cpp or .hpp file. There is no option in the File New dialog to create either of these types of file I can't even add a plain .txt file
Going to Project => Add New Item doesn't help either. I still don't have .cpp or .h or .c to choose from.
Yet I can add everything else: .ico, .bmp, JScript etc etc etc. What's going on?
|
|
|
|
|
Sounds like your install of VS.net is seriously messed up. I suggest reinstall
Alex Korchemniy
|
|
|
|
|
Hi,
For some reason my CListBox, which is flagged as LBS_OWNERDRAWFIXED, does not send a WM_DRAWITEM message when I add strings to it. Without that, I can't draw the text.
Does anyone know how I could draw the text on the ownderdraw listbox, or get it to send WM_DRAWITEM? I have a function to draw the text once I get the DRAWITEMSTRUCT but without that I don't know what to do!
Thanks!
Kelly Ryan
|
|
|
|
|
Nevermind, I figured it out...
Kelly Ryan
|
|
|
|
|
Hi everybody,
I want to create a program like linux that has a kernel and some leyers.If there is some usefull links please tell me.
Thanks.
|
|
|
|
|
Anonymous wrote:
I want to create a program like linux...
That is one tall order. Are you sure you want to embark down the road of creating an operating system?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Why?
I want this program to have Graphic,Security,... leyers.
This makes my work very easy for updates and bugs!
Cheers,
Thanks.
|
|
|
|
|
|
I am making a client server application which for network monitoring in wwhich client will run as NT service.
Now i am really in a fix should i do the project in MFC or C++ builder?
In case of MFC
What are the MFC 's classes and objects which encapsulates "GetUserName()","GetComputerName()","EnumProcess()" and "SetDiCreateDeviceList()" for device lists.
Do u thinks C++ Builder's RAD environment will help in making the project faster?
How different and difficult is it form Visual C++?
Thanks
|
|
|
|