|
There is a bmp resource in my project,IDB_BITMAP1.
I got a HBITMAP handle to the resource.
How could I save it into a *.png?? or other image format.
Thanks.
3.141592653... Never Stop
|
|
|
|
|
|
Hi everyone, i havent been on these message boards in a while and its good to be back. So the other day I ventured into the world of emulators and got a bit interested. I am not ready to program one yet, but was curios as to how one can go about a read a binary or rom file. What I need to do before taking on this project is to understand some things and I am hoping i get some advice and suggestions. First off, do I need to create a simple rom loader based on the rom file's structure, and if so does any one know any good references or books that deal with loaders using c++? All comments are welcome, thnkx!
|
|
|
|
|
Hi Asp .Net Programmer,
Write a Compiler for for a toyish Pascal like language. Grab only a few constructs - read memory location, write memory location, if/then constructs, and type declarations. The bad thing is the front end is tough unless you use lex, flex, bison, etc.
Define your instruction set: 0x01 = memory read, 0x02 = memory write, etc.
Generate your byte codes. At this point, you need an emuator to test your code generation.
It's not a smart ass answer. It's how a class on Compiler Therory would prpbably be taught (it is how the class I attended was taught).
Jeff
|
|
|
|
|
can someone tell me how they work? how does the scanning for invalid entries work?
|
|
|
|
|
Hello,
I have an MFC dialog application (VC++ 6 environment).
I've used the class wizard to create a handler for mouse movement
in my main frame window (to intercept ON_WM_MOUSEMOVE messages).
However, the handler is never invoked.
I can create a handler in the View (rather than main frame) and it is invoked. However, I want to capture all mouse movement, including mousing over the application's main menu area (outside of the view window).
Any help appreciated.
|
|
|
|
|
there is a cover (window) in front of main frame window, mouse movement is delivered to taht front window.
|
|
|
|
|
Can someone please show me, by code example, how to cause Windows Exployer to open on call in a program and to open a specific file.
Your code example would be deeply appreciated.
A C++ programming language novice, but striving to learn
|
|
|
|
|
FYI some C# code that opens an explorer window and highlights the
file specified by string fileSpec:
Process proc=new Process();
proc.StartInfo.FileName="Explorer.exe";
proc.StartInfo.Arguments="/n,/select,"+fileSpec;
proc.StartInfo.CreateNoWindow=true;
proc.StartInfo.UseShellExecute=false;
proc.Start();
and some C# code that opens a file as if you double-clicked it on the Windows desktop:
Process proc=new Process();
proc.StartInfo.FileName=fileSpec;
proc.StartInfo.Arguments=null;
proc.StartInfo.CreateNoWindow=true;
proc.StartInfo.UseShellExecute=false;
proc.Start();
I know it is C#, not C++, but under .NET it is basically the same.
Luc Pattyn
|
|
|
|
|
I know nothing about c#; and as you may have gathered, I know very little about c++. I am learning!
I need real, working c++ code to understand what to do.
Please try to understand, I am a novice to c++, but I desparately wan to learn how to do things CORRECTLY!
I have no idea if c++ has a "key word" or "token" named "Process".
Thanks anyway,
Larry A Mills Sr
A C++ programming language novice, but striving to learn
|
|
|
|
|
The C# code is the eqivelant of using the Windows API CreateProcess() to launch Explorer.exe
and have it open with the specified file highlighted:
STARTUPINFO StartupInfo;
memset(&StartupInfo, 0, sizeof(STARTUPINFO));
StartupInfo.cb = sizeof(STARTUPINFO);
StartupInfo.dwX = 100;
StartupInfo.dwY = 100;
StartupInfo.dwXSize = 400;
StartupInfo.dwYSize = 400;
PROCESS_INFORMATION ProcessInfo;
TCHAR szCommandLine[260];
_tcscpy(szCommandLine, _T("explorer.exe /select,"));
_tcscat(szCommandLine, _T("C:\\AUTOEXEC.BAT"));
if (::CreateProcess(NULL,
szCommandLine,
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS,
0,
NULL,
&StartupInfo,
&ProcessInfo))
{
::CloseHandle(ProcessInfo.hProcess);
::CloseHandle(ProcessInfo.hThread);
}
else
{
DWORD err = ::GetLastError();
}
|
|
|
|
|
On an "Install program I want to give the User the choice of installing the 1) Data Folder on their computer (without installing a Desktop Icon(shortcut)), 2) Install all the Data Folders (with a Desktop Icon), 3) Install a Desktop Icon(shortcut) only for drive "d:\", or 4) view the files from Windows Exployer.
I must be able to have Windows Exployer begin running with the selected file being loaded up if the User selects the 4th option.
Will the code you sent do option 4 as is?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: Will the code you sent do option 4 as is?
This line needs to be changed
_tcscat(szCommandLine, _T("C:\\AUTOEXEC.BAT"));
I've hardwired it to highlight C:\AUTOEXEC.BAT since it was a file that probably exists on your
system so if you tried the code it would work.
You'll want to copy the actual pathname of the file/folder you wish to be highlighted when explorer
starts.
Mark
|
|
|
|
|
Please remember my last email.
I will only use Exployer IF the User selects it. I wouldn't want Exployer to run at any other time.
How do I make sure this happens!
Please excuse my ignorance.
A C++ programming language novice, but striving to learn
|
|
|
|
|
Let me make sure I've got this right - this is an install program you are writing with C/C++
correct?
The user will be presented with 4 options as outlined in the above post.
If option 4 is chosen then the user can choose a location to store the files?
Or is it the location for a folder?
What do you want explorer to default to? The files to install or where the files should go?
How you give the user the 4 choices will determine which processing gets done. You'd only
call/use the explorer code if the user chooses option 4, based on their selection.
Mark
|
|
|
|
|
I'm using VC6 and have no idea what is causing this problem. Normally if you compile a blank windows app you get a lot of imports from kernel32. I believe that this is because the CRT uses them to initialize.
The problem is as soon as I use ANY api from kernel32 all these are lost and I end up with the 1 API I use. Causing the app to crash in the CRT (before WinMain)!
Has anyone seen this happen before, know a solution/workaround or have any idea what is causing it? If I don't use any imports form kernel32 the ones used by the CRT are there and the app runs.
|
|
|
|
|
In my program, I need a structure which looks like:
<br />
struct stru_A{<br />
char Name[MAX_LEN];<br />
float score;<br />
}<br />
Moreover, I declare a vector variable of type stru_A to hold Name_Score pairs. My problem arises with the member variable 'Name'.
<br />
vector 'struct stru_A' Name_Score_Collection;<br />
<br />
In the above declaration of stru_A, the size of Name, MAX_LEN, is predefined to be 30(#define MAX_LEN 30, to hold the longest name in my database). However, in the database many peoples' name are much less than 30 letters. Hence, much valuable memory space are wasted. I wonder what's the way to solve this problem.
I have tried with a string variable. It is true it can solve this problem. However, in the later part of my program I need to write each struture in vector Name_Score_Collection into a file on my hard disk. I used CFile::write() to accompolish this. CFile::write() worked fine with 'char Name[MAX_LEN]', but not with 'std::string Name'. I think this is because function write() need to know the exact size for each structure to be write out. The size of a string variable is not fixed.
-- modified at 9:29 Saturday 16th December, 2006
|
|
|
|
|
Use a CString/std::string instead?
Or use a map of names/scores:
std::map<std::string, float> aMap
aMap["cy163"] = 100.00;
Or even a std::vector of std::pair :
std::vector<std::pair<std::string, float> > myVec;
myVec.push_back(std::make_pair("cy163", 100.00));
|
|
|
|
|
Much better answer than mine. It's what I get for working in an MFC house.
Software Zen: delete this;
|
|
|
|
|
I have tried with a string variable. It is true it can solve this problem. However, in the later part of my program I need to write each struture in vector Name_Score_Collection into a file on my hard disk. I used CFile::write() to accompolish this. CFile::write() worked fine with 'char Name[MAX_LEN]', but not with 'std::string Name'. I think this is because function write() need to know the exact size for each structure to be write out. The size of a string variable is not fixed. But, I am not sure about this.
|
|
|
|
|
You will need to store the size of each string, the string data, and then the float. More complicated than simply writing an entire structure to disk but a worthwhile exercise nonetheless.
|
|
|
|
|
Not to steal your thunder Rob... The following works under VC6.0 also (and stays within the standard C++ library). See std::string widen() and std::wstring narrow()[^]
Jeff
std::string StringNarrow( const std::wstring& wide ) {
typedef std::ctype<wchar_t> CT;
std::string narrow;
narrow.resize( wide.length() );
CT const& ct = std::_USE(std::locale(), CT);
ct.narrow( &wide[0], &wide[0] + wide.length(), '_', &narrow[0] );
return narrow;
}
std::wstring StringWiden( const std::string& narrow ) {
typedef std::ctype<wchar_t> CT;
std::wstring wide;
wide.resize( narrow.length() );
CT const& ct = std::_USE(std::locale(), CT);
ct.widen(&narrow[0], &narrow[0] + narrow.length(), &wide[0]);
return wide;
}
|
|
|
|
|
Very useful. All my string widening/narrowing is done using MS specifics likes WideCharToMultiByte .
Not sure how it helps the OP though!
|
|
|
|
|
Since you're already using the STL vector class, why not use it's string class?
Software Zen: delete this;
|
|
|
|
|
I have tried with a string variable. It is true it can solve this problem. However, in the later part of my program I need to write each struture in vector Name_Score_Collection into a file on my hard disk. I used CFile::write() to accompolish this. CFile::write() worked fine with 'char Name[MAX_LEN]', but not with 'std::string Name'. I think this is because function write() need to know the exact size for each structure to be write out. The size of a string variable is not fixed.
|
|
|
|