|
The Debug version of new and delete use some extra memory buffers to detect things like memory overruns. Trying to mix Debug and Release versions of Dlls/EXEs can cause things like that. Also, STL containers are not thread safe, so you will need to protect them within the DLL.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: Also, STL containers are not thread safe, so you will need to protect them within the DLL.
I missread the MSDN docs on that one. How would you protect them? Locking the memory?
|
|
|
|
|
the debug versions of malloc/free and new/delete are different from the release versions.
MSFT:
If you do choose to mix CRT libraries, remember that you have two separate copies of the CRT, with separate and distinct states, so you must be careful about what you try to do across a CRT-boundary. There are many ways to get into trouble with two CRTs. Here are just a few:
• There are two separate heaps. You cannot allocate (explicitly with new, malloc, or so on -- or implicitly with strdup, strstreambuf::str, or so on), and then pass the pointer across a CRT-boundary to be freed.
• You cannot pass a FILE* or file handle across a CRT-boundary and expect the "stdio low-level IO" to work.
• You cannot set the locale in one and expect the other's locale to be set.
|
|
|
|
|
I'm attempting to display a drag image using IDropTargetHelper but it's not working. I can call CoCreateInstance(CLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER, IID_IDropTargetHelper, (LPVOID*)&m_spdth) and get a pointer, but all calls to functions return a HRESULT of "Interface not registered".
I'm using Windows XP SP2 and my shell32.dll version is 6.0.2900.2951. I used TypeLib viewer to look in my shell32.dll and didn't find the IDropTargetHelper interface. Is there something I'm missing?
Edit: I just realised that while dragging within a single explorer window creates the SysDragImage window class, dragging it into another explorer window is broken as well. I wonder how long it has been since I noticed...
-- modified at 16:21 Monday 21st August, 2006
|
|
|
|
|
I need to be able to display the "space" in an edit box with something visual.
I'm trying to handle the EN_UPDATE message which seems to be the one message to use because it will be also handled when pasting text in the edit box.
I'm not certain how to go from there, I cannot re-set the text to the control, but this will trigger another EN_UPDATE message, and will have an infinite loop.
BEGIN_MESSAGE_MAP(CMaxEdit, CEdit)
ON_CONTROL_REFLECT(EN_UPDATE, OnEnUpdate)
END_MESSAGE_MAP()
void CMaxEdit::OnEnUpdate()
{
CString s;
GetWindowText( s );
s.Replace( " ", "*" );
}
any suggestions ? I could not find the appropriate google query to have some usefull links.
Thanks.
Max.
|
|
|
|
|
void CMaxEdit::OnEnUpdate()
{
CString s;
GetWindowText( s );
if(s.Replace( " ", "*" )) SetWindowText(s ); // will trigger an infinite loop.
}
|
|
|
|
|
Set a flag in your EN_UPDATE handler to control execution:
void CMaxEdit::OnEnUpdate()
{
static bool InEnUpdate = false;
if (!InEnUpdate)
{
InEnUpdate = true;
InEnUpdate = false;
}
}
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hello,
In my application, I need to write some results that have been obtained after doing calculations into a pdf file. I have seen articles on codeproject on how to convert text files into pdf. But text files will not have colouring etc.
I was wondering if it is possible to integrate an independent pdf writing software like pdf995 into my application and make it do the pdf writing silently.
Please advise.
Fortitudine Vincimus!
|
|
|
|
|
pdf995 just pretends to be a printer, so you can print anything you like to it - one solution would be to generate a html table of your data, and print that to pdf.
|
|
|
|
|
benjymous wrote: print that to pdf.
Print to pdf by making the application to choose the pdf995's ( or any other pdf printer) printer silently? Is that right? If that is so, how can I silently choose the printer and execute the print command?
Fortitudine Vincimus!
|
|
|
|
|
Just write your own pdf exporter. It takes a bit of time but it frees you from other peoples code from that day forward. It took me about 6 months to write a GDI/GDI+ compatible, xml parsing PDF exporter that I can now use in all my apps. Well worth the time and effort.
PDF Reference Fifth Edition[^]
|
|
|
|
|
Hello,
I am trying to write simple text of different colors to pdf. So far I have been able to write a string of grey color to pdf. But I need to write other lines too with blue color. Please can you guide me on how to do this?
If we use BT for start of text object and ET for end, a string can be written of a particular font and color.
Now if I have to write another string of some other color, do I have to use another set of BT and ET? I tried it this way but it is not working. Either I have missed the topic in the pdf manual or am not understanding something.
Any help will be highly appreciated.
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
Tara14 wrote: do I have to use another set of BT and ET?
That's how I do it.
"BT /F1 30 Tf 100 -100 Td (Test) Tj ET\n"
/* NOTE: I make my Y axis match my GDI/GDI+ mapping mode so you may find things a little different in terms of the Y axis in your environment. I use MM_ISOTROPIC and I make sure the Y goes downward as it increments so I set all my PDF media boxes accordingly. PDF default rect is left/bottom to right/top which did not make it easy to reuse my GDI/GDI+ action data unless I flipped it around */
Also, PDF will keep track of it's graphics state. This means you only need to change the stroke color, stroke width, fill color etc... when they change. You can choose to explicitly set it on each drawing command but you can save lots of file space if you only change it when you need to.
Does your output format resemble the above (ignoring the values of course)?
|
|
|
|
|
Thank you for your reply.
bob16972 wrote: Does your output format resemble the above (ignoring the values of course)?
Yes. The format is exacly like this. In palce of (Text) I enter in the string that should be written to pdf. Lines are seperated by T*(Text)Tj.
bob16972 wrote: "BT /F1 30 Tf 100 -100 Td (Test) Tj ET\n"
I am a bit confused here. /F is the font type, right?
Whatever font is being used must be described earlier in the font dictionary, right?
Is <code>(Text)</code> the entire text that is being written to pdf? Suppose the text is something from a doc file.
If yes, how does the pdf know which part of the text uses which font and which color?
You mentiond that "Also, PDF will keep track of its graphics state. This means you only need to change the...."
I do not understand this. Please can you elaborate a little.
Thank you once again for your help.
Fortitudine Vincimus!
|
|
|
|
|
Tara14 wrote: I am a bit confused here. /F is the font type, right?
That is the resource name. A good example of this is on page 270 (292 of 1236) of the PDF Specification 1.6
Tara14 wrote: Whatever font is being used must be described earlier in the font dictionary, right?
PDF is written to be read somewhat backward but I believe you will see many different ways of laying the file out. The rules are very confusing and complex in my opinion. My implementation ends up declaring the font descriptor objects toward the front but the resource names get associated with the font descriptors in my Pages object which happens to be toward the end of my file slightly before the Cross Reference and the Trailer. However, you can lay your file out in any way that does not violate the rules in the specification so it would be wrong for me to say yes or no to this question.
Tara14 wrote: Is (Text) the entire text that is being written to pdf?
Yes (Except for the parenthesis of course). Don't forget to apply PDF escape sequences as described on page 30 (52 of 1236) of PDF Specification 1.6 to prevent string literal characters from conflicting with the PDF file.
Tara14 wrote: Suppose the text is something from a doc file.
If yes, how does the pdf know which part of the text uses which font and which color?
It is up to you to tell PDF what to render and how to render it. If you don't know how to parse the doc file, you will be unable to tell PDF what to draw and where and with what color etc...
My documents are described in XML so I parse the information that describes the action of drawing each graphics primitive (lines, bezier curves, rectangles, and Text) and then I translate it to a GDI/GDI+ graphics primitive command if drawing to the screen or printing or to PDF postscript that corresponds to the equivalent PDF graphics primitive command if exporting to PDF. If you do not have the information necessary to parse the doc file, you will have to resort to a print driver strategy like some vendors but I'm afraid I have no experience there and would be of little help.
Tara14 wrote: You mentiond that "Also, PDF will keep track of its graphics state. This means you only need to change the...."
I do not understand this. Please can you elaborate a little.
For example...
If you set the Stroke color to red, all subsequent graphics commands will use red for the stroke color until the graphics state goes out of scope (as described in the specification) or until the Stroke color is explicitly set/changed by you. If the Fill color is set to blue all subsequent graphics commands that use a fill color will use blue until the graphics state goes out of scope or until the fill color is explicitely set/changed by you. etc...
I hope that helps
|
|
|
|
|
Thanks a lot for your patience. I am begining to understand quite a lot now.
This is a bit complex and confusing, but I guess the more I read the manual, the better I will understand.
Thank you once again.
Fortitudine Vincimus!
|
|
|
|
|
Hello,
Is there anyway I can open the pdf from the application one it is created? Shellexecute is not working.
I searched codeproject and found "A simple wrapper to control Acrobat Reader from your application, By seasidetech." but it does not work if adobe is not already open. And I am not able to understand why.
Please help.
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
I'm not sure what you mean when you say ShellExecute is not working. Once I export my .pdf to some path, I call ShellExecute to display it. This is of course assuming Adobe Reader is installed on the machine using the "open" verb
// Note: pApp obtained via AfxGetApp()
ShellExecute(pApp->m_pMainWnd->GetSafeHwnd(),"open",sPath,NULL,NULL,SW_SHOWMAXIMIZED);
|
|
|
|
|
Is there a way know at what time the system has been shutted down. When the system has been started.
Thank You.
KIRAN PINJARLA
|
|
|
|
|
kiran.pinjarla wrote: When the system has been started.
One way is via the Win32_OperatingSystem WMI class. GetTickCount() is only good for about 49 days.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Start time
DWORD GetTickCount(VOID); return the time in mili seconds since the system has been started from that you can calculate the time when it has been started and how long
shut down
?
G_S
|
|
|
|
|
kiran.pinjarla wrote: s there a way know at what time the system has been shutted down. When the system has been started.
write a Winlogon notification package!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
In a property page i will enter some field names.using this names I want to create a table in the database.
Can u Plz help.
thanks in advance.
|
|
|
|
|
What is your problem exactely ? What have you already done ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
So what is your problem.
Working with Property Pages or Filing the entries in the database
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|