|
maybe, if you manipulate doc files, you can use ShellExecute() with the "print" option...
TOXCCT >>> GEII power
|
|
|
|
|
I am sorry. I am not yet up to manipulating docs. I thought I could go into the MFC exe. and create it through that process. I was also thinking that after I compiled and ran my program I could go and create the print option with MFC. Are there any good books that I can read for this purpose.
|
|
|
|
|
"Now I would like to give the person an option to print it."
Print it , what is "it" . C++ Source code ?
"How to I incorporate my C++ code into the MFC environment so when it runs a printout could be made"
again print out of what .
|
|
|
|
|
After I run my code I am left with an exe file. When I run the program I am not able to print it. I would like to be able to run the program and print it out.
|
|
|
|
|
BRIMID wrote:
I would like to be able to run the program and print it out.
the program ??? hum, i think it's not clear in your mind about what a binary/compiled program looks like...
TOXCCT >>> GEII power
|
|
|
|
|
BRIMID wrote:
I have written a C++ project that runs fine. Now I would like to give the person an option to print it.
Print what? By "C++ project" do you mean you want to print the source code that your C++ project is comprised of? Otherwise, "printing my program" makes no sense.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
I've programmed my win32 app and it works correctly, but, suddenly, it doesn't works (yes, I know it's incredible, but true )
The trouble is in CreateThread, I have this:
hThread = CreateThread(NULL, 0, RunTask, NULL, 0, &dwThreadId);
if (hThread == NULL) return FALSE;
and the function:
DWORD WINAPI RunTask (LPVOID)
I execute the app, step by step, and hThread takes a correct value and GetLastError returns me 0 (there isn't any error)
So, why don't execute the function??? I don't understand it because some days ago the program works correctly and I've not added or removed any instruction
Has someone any idea about this mystery?
Thanks in advance
|
|
|
|
|
DWORD WINAPI RunTask (LPVOID)
probably you should write
DWORD WINAPI RunTask (LPVOID pParam)
otherwise I have no idea or you aren't coherent
gabby
|
|
|
|
|
Is this a RAW Win32 Application?
If oyu use the C-Run Time Library, you might want to read about _beginthreadex and possibly use it instead. The wealth of warnings against using CreateThread is quite fascinating. This COULD possibly be your problem.
|
|
|
|
|
Could someone explain "traits" so that an idiot (myself) can understand it. I have 3 STL books and I still dont get it...
thanks-
|
|
|
|
|
I'll try to explain what traits are with a simple example. Suppose you're writing a template function for advancing an iterator n positions:
template<typename Iterator>
Iterator advance(Iterator it,size_t n)
{
for(size_t i=0;i<n;++i){
++it;
}
return it;
} So far so good. After writing this, you promptly realize that advance can be implemented in a more efficient maner when the iterator is a pointer. You consult your C++ book about partial template specialization and write the following:
template<typename T>
Iterator advance(T* it,size_t n)
{
return it+n;
} So yo have the default implementation for any type of iterator and a fast implementation for pointers (of course, the fast solution is not applicable to every iterator type, since forward iterators can only be advanced one step at a time.) This is OK, but it is not perfect: some iterators, which are not pointers, could benefit of the fast implementation. Specializing advance for every random-access iterator you know of is not practical, since the user can provide her own iterators, and you want to remain as generic as possicle. What you'd really want to write is:
template<typename Iterator>
Iterator advance(Iterator it,size_t n)
{
if(Iterator is random-access){
return it+n;
}
else{
for(size_t i=0;i<n;++i){
++it;
}
return it;
}
} This pseudocode cannot be easily be turned into real code. How do you express the "Iterator is random-access" constraint? A first shot at this is the following: suppose the iterators you're passed have a nested typedef whose only purpose is to tell you wether they are randon-access or not:
struct random_access_category{};
struct default_access_category{};
template<typename Iterator>
Iterator advance(Iterator it,size_t n)
{
return advance_helper<typename Iterator::category>(it,n);
}
template<typename IteratorCategory,typename Iterator>
Iterator advance_helper(Iterator it,size_t n)
{
for(size_t i=0;i<n;++i){
++it;
}
return it;
}
template<typename Iterator>
Iterator advance_helper<randon_access_category>(Iterator it,size_t n)
{
return it+n;
} So, given an Iterator , its nested typedef Iterator::category can be used to dispatch to the most appropriate implementation of advance . But:- An iterator is not guaranteed to have such a category typedef, no matter how bad you need it.
- Pointers cannot have a nested typedef
Here's where traits enter. Instead of requiring that an iterator type provides information about itself, we obtain such information from a separate class:
struct random_access_category{};
struct default_access_category{};
template <typename Iterator>
struct iterator_traits
{
typedef default_access_category category;
};
template <typename T>
struct iterator_traits<T*>
{
typedef random_access_category category;
};
Iterator advance(Iterator it,size_t n)
{
return advance_helper<typename iterator_traits<Iterator>::category>(it,n);
}
This traits technique allows us to describe built-in types, as I've shiwn before, and also types written by someone else, without touching her source code:
#include "FastIteratorLib.h"
template<typename T>
struct iterator_traits<fast_iterator_lib::fast_iterator<T> >
{
typedef random_access_category category;
} I hope you've gotten the idea. Our advance is now maximmaly efficient and can cope with built-in types and types from external libraries.
Well, this is more or less what traits are: class templates full of nested typedefs whose purpose is to desribe the properties of an external type, so that generic code can take advantage of this extra information.
Did this help?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Joaquin,
Thanks for your answer.It was very helpful- I'm starting to get the picture. I guess haven't written enough STL routines to "think that way" - thanks again
|
|
|
|
|
I'm trying to write a plugin for a freeware taskbar replacement application, which would duplicate the functionality of the system tray. i.e. I need to know whenever icons are added/updated/removed from the system tray, and ideally whenever tool-tips appear. I've snooped around here and MSDN a bit and can't find anything related to how to do this. Closest thing I've found is http://www.codeproject.com/shell/ctrayiconposition.asp, but it's of no help.
I am guessing some sort of system hook is what I will need to resort to, but I'm not quite sure if that is the case. Does anybody have any experience with this?
Thanks,
D
|
|
|
|
|
Paul Diliscia did an article on bands in 1997 or their about. Search for MSDN Journal "C++ Under the Hood", please correct me if I am wrong.
I believe that article made a taskbar replacement.
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
Well, I tried searching for lots of things. I searched for "C++ Under the Hood", "Paul DiLascia", "Paul DiLascia taskbar", "taskbar", and "taskbar replace", as well as all the other searches I have tried in recent days, but have come up empty handed.
Any other info you can give me to help me find it?
Thanks
|
|
|
|
|
You bet, I should have done this first.
http://www.dilascia.com/
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
I have been trying to use library functions in a 3rd party DLL.
The first routine I try and use results in a Link2019 error.
I have included the header, .Lib and .DLL files in my project, but a bit lost to this error.
Any items/settings I should check?
|
|
|
|
|
sweep123 wrote:
The first routine I try and use results in a Link2019 error.
I assume this is a .Net project.
sweep123 wrote:
I have included....Lib and .DLL files in my project, but a bit lost to this error.
One or the other, but not both.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi
Use the Help dll to load and load it up high before you load the dll. Do not include the lib unless you must for ep issues.
HINSTANCE hLiba = LoadLibrary( "dbghelp.dll" );
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
I want to have an MFC image frame that when you drag a picture from a web site or hard drive onto the frame the program copies the image to a selected folder and displays the image in the frame. I found the option to accept files but i don't know what to do from there. Any assistance would be helpful. Thank You.
|
|
|
|
|
maybe overloading the "drag & drop" event would be an add ?!
TOXCCT >>> GEII power
|
|
|
|
|
Hi,
I have a program that uses the parallel port to send data to an external device. The program uses UserPort as the driver. The problem is it works on my Windows 2000 machine, it works on 2 laptops with XP, but it doesn't work on other XP laptop and works sporadically on another XP desktop. After testing I believe it's the bit of the program that deals with the parallel port.
My question is did anyone have any similar experiences? Are there any other good drivers to try for the parallel port because UserPort is (c) 2001 which may be old.
|
|
|
|
|
Try a Google search on "porttalk". It comes with some code to include in your app, and a driver. I have used this with good success on multiple XP systems.
Good luck,
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
How can I use a toolbar to suspend my thread?
|
|
|
|
|
Define a global boolean variable, inside your thread if that value is true then you can either sleep, or wait on an event otherwise you do your thread's work.
Don't use SuspendThread and other similar functions because it may mess up the thread.
|
|
|
|