|
Which line is giving the assertion? What does the call stack show?
Michael
|
|
|
|
|
HI
Is there any way to use or accommodate ‘CdialogBar’ with ‘Cdilalog ‘ ?How?
I tried to do this but an error at runtime occurred ,my code like below :
BOOL CmyDlg::OnInitDialog()
{
. .
. . .
m_DialogBar.Create(this, IDD_DLGBAR, WS_VISIBLE|WS_CHILD|CBRS_LEFT, 1);
m_DialogBar.EnableDocking(CBRS_ALIGN_LEFT);
}
Thank you ,,,
AHMAD ALWASHALI
|
|
|
|
|
I'm currently writing a file viewer and I would like to automatically unzip .ZIP files to preview their content. My unzipper is a .dll which uses the zlib library. This is a very important part of the application.
Below is the method which reads a .ZIP file in the .dll. I would like to callback my application and give it a pointer to the buffer (an array) containing each unziped file.
As I've never written any callback I don't really know how to implement this, can someone explain me the howto. Thanks in advance.
void C3DZipLoader::Load(char* fileName) {
char* pszFileName;
unzFile hUzf = unzOpen(fileName.ToPStr());
if (hUzf==NULL) return NULL;
pszFileName = new char[MAX_PATH];
if (unzGoToFirstFile(hUzf)==UNZ_OK) {
while (true) {
ZeroMemory(pszFileName, MAX_PATH);
unzGetCurrentFileInfo(hUzf,
NULL,
pszFileName, MAX_PATH,
NULL, 0,
NULL, 0);
if (unzOpenCurrentFile(hUzf)==UNZ_OK) {
// We read the stream form Zlib and get a buffer
// containing the file then we...
<do_the_callback_call_here>
unzCloseCurrentFile(hUzf);
}
if (unzGoToNextFile(hUzf)!=UNZ_OK) break;
}
}
delete [] pszFileName;
return <something>;
}
Yarp
|
|
|
|
|
how can i convert a .bmp file to .jpg file programmatically?
|
|
|
|
|
a/ use GDI+ ( see my articles )
b/ use another library like paintlib ( see the FAQ )
c/ download the jpeg library ( see any of the libraries mentioned in the FAQ, they all use/link to it )
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
How to make a group of statements act as one instruction? All of them are executed without being interrupted by other thread or none is executed.
Here is the trouble I meet:
Several threads are used in my project and I want to suspend certain threads in some conditions. I use following statements:
::GetExitCodeThread( pThread->hThread, &dwExitCode );
if( dwExitCode == STILL_ACTIVE ){
pThread->SuspendThread();
}
// pThread is the point to the thread
I have to make these statements act as one statement so that the thread will not quit and pThread is valid when "pThread->SuspendThread()" is executed.
Thanks in advance!
|
|
|
|
|
All of them are executed without being interrupted by other thread
Nope, the OS can interrupt any thread at any time. That's the whole point behind preemptive multitasking.
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
One solution might be to introduce an Event synchronization object into your program. You can associate one event object with every thread, and make it set by default. The last line in the thread's function (before it exits and the thread ends) would be "WaitForSingleObject(hThreadEvent, INFINITE)". Since the event is SET by default, most times the thread will just continue - and terminate.
Now, wherever you have a bunch of lines such as
::GetExitCodeThread(...)
...
Just reset the event object that is associated with the thread in question. Something like:
ResetEvent(pThread->hEvent);
::GetExitCodeThread(pThread->hThread, &dwExitCode);
if (dwExitCode == STILL_ACTIVE) {
pThread->SuspendThread();
}
SetEvent(pThread->hEvent);
Now, after writing that, I wonder what would happen if the thread function will PASS the WaitForSingleObject, and then a context switch will take place, and only then your ResetEvent(pThread->hEvent) will execute. In such a case, I guess your problem still exists.
So let's change that solution a little. What if, instead of depending on the thread's exit code returned by the OS, you'll manage that yourself? Again, an event object will be associated with each thread. When the thread starts executing, it will RESET the event.As long as the event is RESET - the application can know that the thread is still executing. I added a critical section there - because otherwise under certain circumstances a cotnext switch would have still caused problems.
Thread:
-------
ResetEvent(hEvent)
... thread stuff ...
...
... Want to exit ...
EnterCriticalSection(&csThread)
SetEvent(hEvent)
LeaveCriticalSection(&csThread)
App:
----
EnterCriticalSection(&csThread)
if (TIMEOUT == WaitForSingleObject(hEvent, 0))
{
// Thread is still executing
pThread->SuspendThread()
}
LeaveCriticalSection(&csThread)
And now that I think about it - adding a critical section to the previous idea should also fix it, so you can choose any of the two.
Good luck...
|
|
|
|
|
Oz,
Thank you very much!!!
|
|
|
|
|
I want to get a point to toolbar of the application. What I do is:
CMainFrame *pMainFrame = ( CMainFrame * )AfxGetMainWnd();
CToolBar *pToolBar = ( CToolBar * )( pMainFrame->GetControlBar( IDR_MAINFRAME ) );
Unfortunately, pToolBar is NULL! What's wrong?
|
|
|
|
|
I want to show [+] even the item hasn't child,
and then,when I expanded the item,if it hasn't child,the [+] hided,what should I do?
code sample will be more helpful,thank you.
|
|
|
|
|
Set the TVITEM::cChildren member to I_CHILDRENCALLBACK. This makes the control send a TVN_GETDISPINFO message to determine when to show the + button. See the docs on TVITEM for more details.
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
When you add the item you set cChildren to 1, then you have to handle TVN_ITEMEXPANDING notification and populate the item with child items. If you add no items, then you set cChildren to 0.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hi:
Can I send an e-mail using OnFileMail() function that MFC provide, but customize the content of mail, that is, use own text as mail content rather than use CDocument content as mail attachment?
|
|
|
|
|
See PJ Naughter's excellent CMapi class: http://www.codeproject.com/internet/cmapi.asp
It's very easy to use, and provides a good reference to using simple MAPI should you want to write your own code.
Or if you'd rather, just copy the code from MFC's OnFileSendMail() and replace the bit that serializes the current document with something to generate your own attachment. (this code is not as nice though)
|
|
|
|
|
Hi, I have a dialog, and have some edit controls in it, can I make them support drag and drop, and how to?
|
|
|
|
|
Check out my article on drag and drop. That covers making the dialog a drop target. I think there's also an article here (or maybe CodeGuru) with a CEdit-derived class that supports drag & drop.
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
I'm looking to obtain a session handle from within IE. I'm attempting to write an extension dll. In the dll I'm using a wininet lib call that requires an HINTERNET as an argument (InternetSetOption). I've noticed that a call to InternetOpen will return an HINTERNET, however I believe this is used only when external to IE.
Any clues ?
Many Thanks
Peter Hayward
Ngarkat Technologies
Dulwich, South Australia,
Australia
61 8 8364 7060
phayward@bigfoot.com
|
|
|
|
|
i have lpBitmap = (LPBITMAPINFOHEADER)AVIStreamGetFrame(pVideoFrame, nFrame);
How can i save AVI frame as BMP file?
|
|
|
|
|
Hey all!
I compiled an ATL ActiveX Control DLL using Visual C++ 7 - and noticed that the DLL depends on MSVCRT70.DLL...
I have several questions:
1. Can I somehow remove this dependency?
2. What's in that DLL anyway?
3. Suppose I will compile the code with Visual C++ 6 - it will depend on MSVCRT.DLL, right?
4. Is it possible to remove THAT dependency?
5. Is there any software that comes with MSVCRT.DLL EXCEPT for Visual C++? (Internet Explorer, or Office, or something common like that?)
6. Suppose I want to distribute that file along with my ActiveX Control (for download on a web page) - will it work from the control DLL's directory? Need I put it in the user's Windows\System directory? Need I do anything else? Is it legal to distribute this DLL just like that?
Thanks a lot!
|
|
|
|
|
In VS.NET (VC 7), right click on your project in the Solution Explorer and choose properties. The General tab has an option fo "Minimize CRT Use in ATL", switch this to Yes and you should statically link to the CRT's.
If you build it with V6, if you use the min_dep project configuration you will statically link to the CRT's and no longer require that DLL.
You can distribute that DLL with your ActiveX Control and put it in the same directory as your control and that should work.
Later,
Walter Sullivan
Lead Program Manager, MFC/ATL
|
|
|
|
|
Thank you very much
|
|
|
|
|
Hi,
I want to send some special keys using keybd_event. I tried many ways, but I could not achieved.
Please help. How can I send special keys (such as German Language specific characters)?
Kind regards
Mustafa Demirhan
|
|
|
|
|
Hi,
I think you can't send characters, only virtual keys.
You may do the conversion with VkKeyScan.
Don't ask me details, 'cause I never tried
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Hello,
How can I wake a computer from standby within my Visual C++ program (that is working on that computer)? I tried to send keystokes, but as expected, it did not work...
Thanks for any helps
Kind regards
Mustafa Demirhan
|
|
|
|