|
You might also consider using some form of file compression on the images and then expand them into memory. I have seen VERY large bitmaps compress down to much smaller sizes. You can store the compressed images as RC_DATA and then load them from the resources, then expand them into memory. That would save you some space.
|
|
|
|
|
Hi all.
I've written a Visual C++ 6.0 software to calculate the Italian (Codice Fiscale) say that it is like U.S. SSN.
To calculate the C.F. (Codice Fiscale) i use a text file, comma delimited, to find City codes; it works fine.
Now I wander if is possible to embed the text file in the executable to have a compact software made of only one file. Condider that the text file is 247Kb
Thanks to all
|
|
|
|
|
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
im study com current, so i m diffculty understand that ,,,,i use visual studio 6.0,,
so i see build error ......Unreserved symbol error,,,,
what i to use com ? library need? i m inclueded all includ file
|
|
|
|
|
|
Please give me some articles or books or sourcecodes.
Thanks!
|
|
|
|
|
|
I have searched for a way to get the instance handle of the module that my code is executing in.
AfxGetInstanceHandle function available, but only when running as an MFC dll.
GetModuleHadndle is available, but requires the path of the dllm which I don't have.
I cannot inject code in DllMain to "remember" the instance handle because I don't have
access to it.
I have a solution that is quite extensive using "Process Helper", "PE Image Helper" APIs and are quite time consuming. I hope to find a better way of doing it. Probably there exist a way for it, but I haven't found it yet.
Does anybody have a solution for it?
|
|
|
|
|
Per Nilsson wrote:
GetModuleHadndle is available, but requires the path of the dllm which I don't have.
Actually you do. First make a call to GetModuleFileName(...) .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
No
This function returns the module name of the creating process, not the dll I am executing in.
/Per
|
|
|
|
|
If you only have to run on Windows XP or Windows 2003 then look at this one GetModuleHandleEx using the GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS flag.
|
|
|
|
|
Are you sure?
http://www.mvps.org/vcfaq/sdk/7.htm
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yes
"The Win32 API GetModuleFileName() is what you need. If you pass NULL as the module handle parameter, the function returns the path of the module that created the process (in other words - the application's exe file)."
|
|
|
|
|
Did you not read the last sentence for some reason?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
By default in MFC when you clicking button (CButton)
it sends message when button is up.
But I need that some of buttons on my dialog send message when button is down.
What I should change or add to button object or class ?
|
|
|
|
|
I suggest new class:
//// in header file
class CmyButton: public CButton
{
// Generated message map functions
//{{AFX_MSG(CmyButton)
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//// in cpp file
BEGIN_MESSAGE_MAP(CmyButton, CButton)
//{{AFX_MSG_MAP(CmyButton)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CmyButton::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
MessageBox("You click on button");
}
|
|
|
|
|
|
Please help,
How to invork the Internet Explorer with assigned url address?
I want to open the Internet Explorer with "www.yahoo.com" from my MFC project. The WinExec("iexplorer.exe", SW_SHOW) run the iexplorer.exe but with the default url address.
Thanks
|
|
|
|
|
|
Thanks! you're live saver.
|
|
|
|
|
Instead of Using WinExec use ShellExecute
here is small code snippet to Invoke the Yahoo.com from ShellExecute
::ShellExecute(NULL,"open","IExplorer.exe","http:////www.yahoo.com",NULL,SW_SHOW);
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
I'm having some trouble making a thread I have exit nicely. The thread function looks like:
UINT tBeginCommunication (LPVOID pParam) {<br />
t_commPackage * commPackage = (t_commPackage*) pParam;<br />
while (commPackage->cmdStopThread) {<br />
... do thread work here ...<br />
}<br />
commPackage->haveStoppedThread = true;<br />
AfxEndThread(0, false);<br />
return 0;<br />
}
When I want to stop the thread, I have this:
m_serialPortData->cmdStopThread = true;<br />
while (!(m_serialPortData->haveStoppedThread));
It signals to stop the thread, and waits until the thread has stopped.
The problem is that the while loop in the controlling function is never exited, it hammers the CPU and therefore the OS, I need to end the process via Task Manager to get back control. The data is not deleted because of the false argument in the AfxEndThread call so the main function has a chance to read it in the while.
I know I must be missing some thread nuance everyone else knows so please let me know what I'm not doing right. Thanks in advance, Nate.
|
|
|
|
|
Instead of looping over a variable, loop over until you get a signal that says you are done. Something like
while (1)
{
signalledObject = WaitForMultipleObjects(...);
if (signalledObject = THREAD_QUIT)
break;
// Do your job
}
Regards
Senthil
My Blog
|
|
|
|
|
See here for tips on how to properly shut down a thread.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks, that helped a lot. I looked at that page and it showed me better ways of starting and ending the thread nicely. I wanted to use a timeout somehow before I knew about the event handles and signals so this solution works out very nicely. Deriving my class from CWinThread would have been overkill because I don't need that much control but knowing I can do that is good to know. I ended up making 3 handles to signals, one to signal a good start from the thread to the main app, one to signal from the main app to the thread to stop, and one last signal to tell the main app the thread finished and it works nicely. Thanks again for the excellent link, Nate.
|
|
|
|