|
Is there a way to programmatically create a PDF file in
visual c++? I can print to paper and Im hoping that
if I change a few lines somewhere that I can print an
electronic copy in PDF somehow.
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
there are some free libraries you can get that will generate PDFs. You can google for "PDF Generation"
There also are some PDF projects here on codeproject. Search the articles.
|
|
|
|
|
DanYELL wrote: Is there a way to programmatically create a PDF file in
visual c++? I can print to paper and Im hoping that
if I change a few lines somewhere that I can print an
electronic copy in PDF somehow
What about this :-
http://www.codeproject.com/tools/Text2PDF.asp[^]
"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
|
|
|
|
|
Can someone provide me with a simple set of code to show heap memory allocation and deallocation?
Thank you very much
|
|
|
|
|
to allocate memory for an object of type OBJECT
<br />
OBJECT* obj = new OBJECT;<br />
to allocate memory for an array of objects of type OBJECT
<br />
OBJECT* obj = new OBJECT[array_size];<br />
to deallocate memory for an object of type OBJECT
<br />
delete obj;<br />
to deallocate memory for an array of objects of type OBJECT
<br />
delete [] obj;<br />
k_dehairy
|
|
|
|
|
the pink jedi wrote: Memory leak detection
Here what MSDN say about this :-
To detect a memory leak
Create a CMemoryState object and call the Checkpoint member function. This creates the first memory snapshot.
After your program performs its memory allocation and deallocation operations, create another CMemoryState object and call Checkpoint for that object. This gets a second snapshot of memory usage.
Create a third CMemoryState object and call its Difference member function, supplying as arguments the two previous CMemoryState objects. If there is a difference between the two memory states, the Difference function returns a nonzero value. This indicates that some memory blocks have not been deallocated.
This example shows what the code looks like:
// Declare the variables needed
#ifdef _DEBUG
CMemoryState oldMemState, newMemState, diffMemState;
oldMemState.Checkpoint();
#endif
// Do your memory allocations and deallocations.
CString s = "This is a frame variable";
// The next object is a heap object.
CPerson* p = new CPerson( "Smith", "Alan", "581-0215" );
#ifdef _DEBUG
newMemState.Checkpoint();
if( diffMemState.Difference( oldMemState, newMemState ) )
{
TRACE( "Memory leaked!\n" );
}
#endif
Notice that the memory-checking statements are bracketed by #ifdef _DEBUG / #endif blocks so that they are compiled only in Win32 Debug versions of your program.
"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
|
|
|
|
|
Hi
Do anyone know how to get the size of any file in win32 system using APIs.
thanks
|
|
|
|
|
|
GetFileSize if you want to stick to Win32.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
vikramdelhi wrote: Do anyone know how to get the size of any file in win32 system using APIs.
if you tring to open Big file, try GetFileSizeEx
"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
|
|
|
|
|
hi
thanks a lot guys.
you all are really nice guys.
|
|
|
|
|
I want to prevent access to windows explorer when the user is using my app. Therefore, I have created a new desktop to run my app on. This way even though he can run explorer, he cannot practically use it. However, if from my app's open/save dialogs the user right-clicks and selects the explore option, he gets a new instance of explorer running on my desktop.
My question therefore is how do I prevent this? As far as my app goes, I can think of replacing the standard open/save and browse for folder dialogs with custom made ones. However, my app uses certain third-party resources for which I cannot do the same. Can I then somehow "hook" these dialog boxes, and prevent the user from running explorer.
Any other ideas on achieving my end result are welcome.
Thanks!
|
|
|
|
|
Krishnan V wrote: I want to prevent access to windows explorer when the user is using my app.
Why? What is it that you are ultimately trying to prevent access to?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
My application is used in critical applications. Therefore, normal users are not allowed to use anything outside of my app. Not even calculator! To get access to other applications, I might provide a password-protected option to them.
|
|
|
|
|
Hi ,
I m having problem updating my temporary Access databse , I get messages from socket every 1 sec , and I have to update Access tables . My application is a multithreaded , so there are times when multiple threads are trying to reand/ write same table.
Now my problem is I have tried to open Access table through CRecordset class , and when I debug it locally it run fine in multithread environment , like same table is opened by thread 1 and thread 2 is reading it , thread 3 is updating it etc.
But when I go live , I get errors like :
"Could not update; currently locked by user 'admin' on machine 'XXX"
how to catch this bug ? n how to fix it ?
plz can any body help ? If I use MS SQL SERVER can it resolve problem ?
Thx,
Zinc
HELLO
|
|
|
|
|
Hello
One way is to use a Mutex (and keep Access).
You could create a special function (or class) that handles all reads from, and writes to, the Access DB.
In that function (or class), use a Mutex.
Or, if reads are allowed at all times, just block the writes with a Mutex.
Kakan
|
|
|
|
|
|
Just as in that you can call LoadLibrary() on a DLL and then use GetProcAddress() to call a function within that DLL, is it possible to export a function from an exe? I know you can call LoadLibrary() and pass it an .exe and it will return a valid handle...
My end result is that I'd like to load an executable by another program (NOT run it) and determine what specific version it is...without using a version info resource within it. If I could set a function to export to return the version, that would be *perfect*.
Any other suggestions on getting at my end result would be appreciated.
Thanks,
|
|
|
|
|
Gunn317 wrote: ...is it possible to export a function from an exe?
Not that I am aware of.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
It IS possible! In searching the internet, I came across this article:
http://www.codeguru.com/Cpp/W-P/dll/article.php/c3649/
In trying to solve this problem yesterday, I had created a Win32 DLL using the VS.NET wizard with one function I was exporting. So, I just copy/pasted the code into a new header file which I included in one of my .exe source files, then linked. That was it and it worked.
I was able to call LoadLibrary() on the exe, then GetProcAddress() for the function. Here's the complete .h needed (VERSION_EXPORTS was defined in the project properties):
<br />
#ifdef VERSION_EXPORTS<br />
#define VERSION_API __declspec(dllexport)<br />
#else<br />
#define VERSION_API __declspec(dllimport)<br />
#endif<br />
<br />
VERSION_API int fnVersion(void)<br />
{<br />
return 6030;<br />
}<br />
|
|
|
|
|
but you are using some dll methods to came across this : dllexport and dllimport
i never seen an application (.exe) defining some symbols that are to be exported... !!
this is done in dll generally.
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
I sure am...I'm sure in most cases this may not be appropriate or needed. But it fits my case perfectly. And since LoadLibrary() and GetProcAddress() both work with .exe's, there's no reason why it can't be done.
Thanks,
|
|
|
|
|
Hi,
I have a problem when creating win32 regions and drawing into them. The edges of the shapes drawing inside the region are distored or cut-off. For example:
CDC* pdc = GetDC();
CRgn rgn;
rgn.CreateEllipticRgn(10,10,50,50);
pdc->SelectClipRgn(&rgn, RGN_COPY);
pdc->Ellipse(10, 10, 50, 50);
pdc->SelectClipRgn(NULL, RGN_COPY);
ReleaseDC(pdc);
Although the coordinates of the region are the same of the ellipse coordinates, it still does not draw the ellipse perfectly. The edges are distorted. Is there a way I can calculate the perfect region. I also do not want to use paths as they don't work properly in win98. What could be the solution.
Thanks
|
|
|
|
|
Are you acconting for the pen width of the border of the object?
In that case, your region needs to be slightly larger than the actual object boundaries, since most programs leave the pen drawing code to drawn ON the object's edge rather than within it.
Since I don't see any code explicitly setting your pen, it could be any guess what it is at the time this code executes. Are you seeing distortion when the pen width is more than 1? I would not expect it too much with this code when the pen width is 1, except maybe at the outer edge of the ellipse.
No shirt, no shoes, no brains, no service.
|
|
|
|
|
Thanks for your reply. I am not selecting any pen into the device, so I assume that the default is a 1 pixel black pen. I tried making the region larger by one pixel, but the result shows the ellipse. However, there are extra little blank spaces around the ellipse. I also tried to make the pen PS_INSIDEFRAME but with the same result.
|
|
|
|