|
Ies they are both visible, the one from class CCalibracionDlg is modal and the one from CDlgMap1 is no modal, why?
|
|
|
|
|
timbk wrote: ...the one from class CCalibracionDlg is modal and the one from CDlgMap1 is no modal, why?
Because modal dialog boxes "block" other windows from processing messages. Your topmost dialog would need to be modeless if you want it to be able to communicate with the dialog below it.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
oh, I didn't know it , so it's imposible send and recive messages between a model and modeless? ok supose that i change the main dialog to modeless , how can i do te send or post a message between the two modeless? with PostMessage?
|
|
|
|
|
timbk wrote: so it's imposible send and recive messages between a model and modeless?
No, it IS possible.
timbk wrote: ok supose that i change the main dialog to modeless...
The main dialog should stay modal. Any subsequent dialogs that you want to communicate with it should be modeless.
timbk wrote: ...with PostMessage?
That's a different topic altogether, and at this point does not matter to you.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks. But , wich is the correct syntax? i wrote the following code in CDlgMapa1
<code>CCalibracionDlg.PostMessage( ? , WM_MYCUSTOMMESSAGE,(WPARAM) wParam,(LPARAM) lParam);</code>
Two questions:
1-What have i put in'?' ? , the handler to CCalibracionDlg (is the object that recives the message) ? in this case , how can obtain it? if you could put some code like an example , would be nice.
2- at that line of code the compiler says : error C2143: syntax error : missing ';' before '.' , sounds like the compiler doesn't recognizes that line. thanks again.
|
|
|
|
|
Well , thanks to all, finaly i get the solution with:
<code>GetParent()->PostMessage(WM_MyMessage,NULL,NULL);</code>
|
|
|
|
|
Hello,
I am trying to get started with some programming, but I'm getting nowhere with an actual interesting sort of a project.
I can do console examples fine, and follow the instructions on the MSDN, but what I want to do is work on editing and creating modules for a program called SynthEdit.
SynthEdit creates Music software synthesizers, and the software has an SDK released.
So if I can figure out how to load a project/solution file from the SynthEdit SDK and actually successfully compile it, I will be able to actually start working on something.
But I am getting nowhere, because I always get errors when trying to compile.
It should be as simple as installing Visual C++ and the Microsoft SDK, then just loading a file from the SynthEdit SDK and compiling it. But something is not working right.
Visual C++ 2008 installs with Windows SDK version 6.0A already installed and ready to go, right? But it doesn't work. I added the file paths to the VC++ directories for Executable files, Library and Include files, it still doesn't work.
I downloaded Windows SDK v 7.0 and added the paths to the VC++ directories, it still does not work.
So What do I need to do to get a Windows SDK integrated into my Visual C++ 2008, so that I can compile something?
I have seen the Microsoft Blog about using the Microsoft Windows SDK configuration tool, it is no help. It fails to be a straightforward step by step guide, and goes into setting directories using the command prompt window without explaining how exactly to do that. So it is useless for a beginner such as myself.
I am pasting the log for my attempt to compile a project called "AGain" below. If anyone sees exactly what the problem is, that would be great. Please don't spend more than a minute or two, I'll have to eventually figure this out, even if it takes weeks.
Build Log
Rebuild started: Project: AGain, Configuration: Debug|Win32
Command Lines
Creating temporary file "c:\Program Files\se_sdk3\AGain\Debug\RSP0000023362984.rsp" with contents
[
/Od /I "..\se_sdk3" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /c /Wp64 /ZI /TP "..\se_sdk3\mp_sdk_common.cpp"
"..\se_sdk3\mp_sdk_audio.cpp"
".\AGain.cpp"
]
Creating command line "cl.exe @"c:\Program Files\se_sdk3\AGain\Debug\RSP0000023362984.rsp" /nologo /errorReport:prompt"
Creating command line "rc.exe /d "_UNICODE" /d "UNICODE" /fo"Debug/AGain.res" ".\AGain.rc""
Output Window
Compiling...
cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
AGain.cpp
mp_sdk_audio.cpp
mp_sdk_common.cpp
Generating Code...
Compiling resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
Copyright (C) Microsoft Corporation. All rights reserved.
.\AGain.rc(10) : fatal error RC1015: cannot open include file 'winres.h'.
Results
Build log was saved at "file://c:\Program Files\se_sdk3\AGain\Debug\BuildLog.htm"
AGain - 1 error(s), 1 warning(s)
|
|
|
|
|
Hi,
Your source code seems to be compiling correctly according to your logs. Its the resource compiler that is failing. Your AGain.rc resource file is including a file named winres.h but the compiler cannot find it. You may be missing an #include path... locate this file and add the path into the projects 'Additional Include Directories'
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks!
I have the VC++ 2008 express edition, which I guess does not include the MFC library.
Perhaps winres.h is in this library, which I don't have.
Anyway, I renamed the winresrc.h file which is included in the Windows SDK, and I got the module to compile! So at least I'm getting somewhere.
|
|
|
|
|
|
See the link here[^] that David posted, it should help you.
|
|
|
|
|
Hi friends,
Thanks in advance.
I am using Acrobat Reader Browser document to show PDF file in my application.
But as I drag drop PDF file into internet explorer, it shows page count of PDF file.
How can I get page count in PDF file through C++/VC++.
Thanks,
Subhash Madhukar
|
|
|
|
|
you mean you are opening pdf document in internet explorer (or web browser control) and need to get the page count of opened PDF document?
--Cool_Dev--
|
|
|
|
|
Hi Cool_Dev,
thanks for reply.
I come to know IE use "Acrobat Browser document" ocx control to open pdf file.
I am using same ocx control but it doesn't expose any function to get open PDF page count.
BUT IE do the same.
I also come to know you can get page count by opening PDF in binary format and search for /Count or /Type /Page pattern.
I opened PDF in binary form using CFile and try to read single line and count " /Type /Page " pattern but as it is binary file, I could not able to read single line.
Line end is specified by '\n' or '\r' or '\r\n' i.e. 0x0A or 0x0D 0r 0x0D 0x0A.
To check the regular expression I used CAtlRegExp class.
If i check all these patterns and read single byte at a time, it takes lot of time. So can you please provide me some c++/VC++ code sample if possible to read the single line in PDF or get the page count.
Thanks,
Subhash Madhukar
|
|
|
|
|
I think Adobe Reader(AR) supports OLE Automation, so that another applications can embed AR with in them and automate it programatically. If IE automates AR to open pdf files, there will be two process running in task manager: iexplorer.exe (IE) & AcroRd32.exe (AR). This is not happening when I opened a pdf document in IE. That means IE uses an ActiveX control (Program Files\Common Files\Adobe\Acrobat\ActiveX\AcroPDF.dll) provided by Adobe. You can use this control in your MFC App by inserting "Adobe Reader" activeX control on dialog. You can generate wrapper class for this OCX, but i couldn't find any method to get no. of pages there.
Another way is to automate AR from you application. The Type Library for AR is Program Files\Adobe\Reader 9.0\Reader\AcroRd32.dll. Use OLEView.exe tool of Visual Studio to see the interfaces that AcroRd32.dll provides. There is CAcroPDDoc interface and it has a methods 'Open' to open a pdf document and 'GetNumPages(long*)' to get no. of pages Create wrapper classes for all necessary interfaces using "Add Class from Type Library" in visual studio, instantiate those classes in specified order, invoke methods on them, finally close the document and release the interfaces. Iam sure that this will work for you...
Every problem has n+1 solutions. 'n' is the number of solutions I have tried and '1' is that which is waiting to be tried.
--Cool_Dev--
|
|
|
|
|
Hi Cool_DeV
Thanks for reply,
I am already using first method i.e. to embed ocx control in my application.
I will give a try 2 second method, but i think it may change with diff. version of acrobat reader ?
Thanks,
Subhash
|
|
|
|
|
U r right. There may be changes in type libraries of different versions of acrobat reader. But if u build ur app with a lower version such as 7, that will run even if the installed version is higher one. The reverse my not be possible.
--Cool_Dev--
|
|
|
|
|
Hi guys,
I am almost finished coding a command console for a home project and have just noticed that the static map I used is causing visual studio to whine about leaking memory on program termination. I have included the code for detecting memory leaks
#define _CRTDBG_MAP_ALLOC
#include <cstdlib>
#include <crtdbg.h>
and I have an assert an the end of the program.
assert(_CrtDumpMemoryLeaks() == 0);
The program bombs during the assert. If I remove my static map it terminates without blowing up but keep it it and BAM. I should point out that almost all code has been commented out and almost all source files removed. The static map is not used at all. It is the declaration of the static map in the .cpp file that causes the so called memory leak.
I think it is because the maps constructor is called during start up as it is a static variable and its destructor is therefore called on program termination. However this is after the last line of code so the assert will always trigger .
Is there any way to get visual studio to ignore the static map because I do not think it is an actual memory leak or do I have to have a static pointer to a map instead of a static map and new and delete the stupid thing myself before the assert?
Thx in advance,
Draemstars.
|
|
|
|
|
You shouldn't worry about it.
The map internally allocates memory in its constructor and deallocates in its destructor.
But when you're calling _CrtDumpMemoryLeaks() you destructor has not yet been called.
So you should not have the assert statement at all.
|
|
|
|
|
The assert statement is there to catch other memory leaks. It has already caught leaks when I forgot to call the destroy function for a class and when I used the normal delete operator instead of the array [] delete.
So taking out the assert while developing could mean I leak memory in future due to some other silly thing I do, and seen as no one is perfect I am bound to forget to delete somehthing else sometime and the assert is there to flag any errors I might make.
Therefore I would rather not take it out even though there is currently no memory leak. I was just wondering is there a flag you can set or something you can do to tell visual studio to ignore the static objects during leak testing which would stop the assert triggering every time I close the application.
|
|
|
|
|
You could get the size of the map using std::map::size() , sizeof(std::map::key_type) and sizeof(std::map::value_type) and then assert on memory leaks more than that size.
You could also call std::map::clean() before doing this.
|
|
|
|
|
Checking the size of the leak is a good idea but I have no clue how to get the amount of memory leaked in code. _CrtDumpMemoryLeaks() just throws a wobbler when memory is leaked, it doesn't give any information on how much memory has been leaked, at least not until it shows up in the output window (60 bytes every time).
I assume you mean std::map::clear() (not clean). I already tried it to no avail.
After a lot of reading I think I am just going to go with a static map pointer instead of a static map. That way I can nuke the new'd map memory myself and make sure it is dead and gone before the program ends and memory leaks are checked for.
Thx anyway though.
|
|
|
|
|
Draemstars wrote: Checking the size of the leak is a good idea but I have no clue how to get the amount of memory leaked in code.
Take a look at _CrtMemCheckpoint[^] and _CrtMemDifference[^].
Draemstars wrote: I assume you mean std::map::clear() (not clean).
Yup. Typo.
Draemstars wrote: After a lot of reading I think I am just going to go with a static map pointer instead of a static map.
I wouldn't recommend it. Especially to support some code that is not going to run in the production build.
|
|
|
|
|
Define
_CrtMemState mem_s1, mem_s2, mem_s3; and at some point in your application, after the static map is created, "checkpoint" the memory usage with
_CrtMemCheckpoint(&mem_s1); and near the end, when you want to check for leaks get a 2nd checkpoint and "diff" them
_CrtMemCheckpoint(&mem_s2);
if (_CrtMemDifference(&mem_s3, &mem_s1, &mem_s2))
{
TRACE("....................Detected Memory Leak in Main Loop\n");
_CrtMemDumpAllObjectsSince(&mem_s1);
TRACE("....................End of Memory Dump\n");
} And if you have an iterative process, these two steps work well at the beginning and end of an interation to catch the "incremental" memory leak.
|
|
|
|
|
Cheers, _CrtMemDifference() worked like a charm.
No more incorrect warnings about leaking memory for me.
Thx guys.
|
|
|
|