|
Thanx Max.
I have done owner draw many times. This is a simple app and I thought I could get away from owner draw.
I just wanted to know for sure.
Anyway thanks for ur time.
Richard
|
|
|
|
|
You can do that with custom draw (not the same as owner draw). I have an article on custom draw here in the list control section.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
How do I put a picture (from a resource) in a ListCtrl background ??
Thanks,
Cris ...
|
|
|
|
|
Unfortunately, you can only use picture files (NOT resources) with the standard list control . To display a picture from a resource you'd need to go owner-draw (or temporarily extract the resource picture to disk file ).
Faith. Believing in something you *know* isn't true.
|
|
|
|
|
Can anyone recommend a simple way of decomressing an archive. I've had a look at zlib and ZipArchive and they are a bit too bloated for the functionality i'm looking for. Just a very basic method of decompressing an archive into a folder?
Cheers
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
|
Hi!
does anyone can tell me why acrobat isn't closing after I print pdf file programmatically.
I have used two ways to print pdf files,
1) ShellExecute()
ShellExecute(NULL,"print","filename.pdf","","",2);
2) system() by passing command line for printing pdf files
<br />
fileName = "e:\\CUM_AuntAnnes_1A_19960329.pdf";<br />
CPrintDialog printer(FALSE);<br />
printer.GetDefaults();<br />
CString command = " acrobat /t ";<br />
command += "\"";<br />
command += fileName;<br />
command += "\" "; <br />
command += "\"";<br />
command += printer.GetDeviceName();<br />
command += "\" ";<br />
command += "\""; <br />
command += printer.GetDeviceName();<br />
command += "\" ";<br />
command += "\"";<br />
command += printer.GetPortName();<br />
command += "\""; <br />
system(command);<br />
Either way print the pdf but left Adobe Acrbat reader opened. So the user have to close it manually. I don't want the user to close it manually.
Is there links or examples to print pdf with adobe acrobat and close acrobat programmatically? Or other better ways to print pdf?
Thank you
|
|
|
|
|
can u not kick it off as a process and then send it a WM_CLOSE message when its finished?
"even if my world is weird it's my world" biz stuff about me
|
|
|
|
|
Here is an another way that I tried,
<br />
<br />
SetShellExecuteInfoStructure(lpExecInfo,print,fileName);
int success = ShellExecuteEx(&lpExecInfo);
if(lpExecInfo.hProcess !=NULL)<br />
{<br />
if(afile->type.CompareNoCase(".pdf")==0)<br />
{<br />
::Sleep(25000);<br />
PostMessage(reinterpret_cast<unsigned int>(lpExecInfo.hwnd),WM_CLOSE,NULL);<br />
}<br />
::WaitForSingleObject(lpExecInfo.hProcess, INFINITE);<br />
::CloseHandle(lpExecInfo.hProcess);<br />
}<br />
I tried it like that and it is not working. I dont know what else I need to do. Infact, I dont' really know how to post the message, I'm a beginner in programming..
Do I have to do something else after I post the meassage in this way???
what else do I have to do?
|
|
|
|
|
|
I am creating a dialog box like this:
CDialog *pDlg;
pDlg = new CDialog();
pDlg->Create(IDD_DIALOG, pParentWnd);
When I do this in a dll, the dll is loaded fine but I get an assert in dlgcore.cpp saying that the dialog template is not found or something to that effect. Of course the template is there in the dll resource scripts, but I don't know what is happening here.
On the other hand, the above code runs just fine in an exe, just like it should.
It's only in the dll version that the problem is there. Is it because both the dll and the calling program have their own .rc files and a dll or exe can have only one .rc? In that case, and i do suspect this is the case, how do I resolve this issue? The calling exe does not know what resources are needed by the dll and both the exe and the dll need to carry their own resources. This way I'll be free to replace the dll in future if I want, or make new "plugins", etc.
I could have the resources in a separate dll and load them from there, but that would be an overkill in my situation. Is there a simpler solution? Because this is not just about dialogs boxes. Any types of resources would cause the same problem. Otherwise I could have used InitModalIndirect() or CreatDialogIndirect() functions.
Thanks very much in advance for your help.
Regards,
Rohit Sinha
|
|
|
|
|
Mh, I suppose you have derived your own dialog from CDialog ? If this is the case, then read on, if not, the I'm sorry
Then you could do it that way:
CYourDialog *pDlg = new CYourDialog(this);
pDlg->Create(CYourDialog::IDD);
pDlg->ShowWindow(SW_SHOW);
Hope this helps
modified 12-Sep-18 21:01pm.
|
|
|
|
|
This is a commonly asked question. See AfxGetResourceHandle() and AfxSetResourceHandle() .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks very much. I was calling AfxGetResourceHandle() and AfxSetResourceHandle() , but in the wrong place - my dll. I called them in the exe and everything became alright.
Regards,
Rohit Sinha
|
|
|
|
|
Glad you're up and running!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
hi.
Im trying to use ReadDirectoryChangesW() win32 call with an IO completion
port on Win2k server SP2.
I use a big buffer (256K) to lpBuffer param.
if i use a Local drive("C:\tmp\") it works fine, but on a nerwork("\\myhosts\tmp\") drive, it fails and the getlasterror() return 87 (The parameter is incorrect).
Otherwise, if the buffer is small (4K), it works fine (network and local).
Thank You a lot!
|
|
|
|
|
I was under the impression it wouldn't work across the network, but I couldn't find any documentation that said it didn't. Hmmm, guess I didn't help much, did I?
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
No, Becouse if the buffer is small (4K), it works fine (network and local), and a big buffer in a local drive ("C:\monitor\") works fine, the problem is a big buffer on a network drive.
Thz.
Juan Carlos S.M.
|
|
|
|
|
Hi, everyone!
I want to send a HTTP request to a Web Server, the body of
the request is NULL and I want to add some customer defined
header fields into the HTTP request header.
I have find some methods, but they are not in detail.
Are there some sample codes?
Cheers,
George
|
|
|
|
|
> telnet www.myserver.com 80
Trying 207.219.70.31...
Connected to www.myserver.com (207.219.70.31).
Escape character is '^]'.
GET /index.html HTTP/1.1
host: test
mycustomheader: wassup!
mycustomcoookie: chocolate-chip
myrootpassword: c0deproj3ct
Hit enter twice and away you go...
Todd Smith
|
|
|
|
|
I have a bmp that I want to put onto a toolbar buton. How do I do this? Additionally, if it were a *.ico file, how would I do the same?
Appreciate your help,
ns
|
|
|
|
|
Lets say I want to do simulations on a group of animals of class CAnimal. First I define a group of dogs of class CDogs inheriting from CAnimals. Then I want to do the same with cats of class CCats, also inheriting from CAnimals, etc.
Lets say we have the following setup:
- A CAnimal object has member data and a set of pure virtual functions
- A CDog or CCat has only static member data in addition to member functions, including the virtual functions from CAnimal.
I would now like to have the ability to change between dogs and cats, i.e. redefine all my CAnimals from being dogs to cats. If I don't make my CDog and CCat destructors virtual, I can delete the dog/cat part and keep the CAnimal base class, but how can I change type?
I guess one way to do it is to take my array of dog objects and make a new array of cat objects and copy the animal part from dog to cat using assignement operator, and then delete may dog array. Or are there more elegant ways..?
Regards, Haakon S.
|
|
|
|
|
I don't thing you can dynamically change the type of an object at runtime, you will need to do this by hand, like you suggested.
Max.
|
|
|
|
|
This can be done (if I understood your question) implementing an idiom called envelope/letter. Define CAnimal as an envelope class, i.e. a class that forwards all requests to another object:
class CAnimalImpl;
class CAnimal
{
void method1(){impl->method1();}
...
int methodn(...){return impl->methodn(...);}
void setImpl(CAnimalImpl *impl){this->impl=impl;}
}; Now, move the definition of your dogs and cats classes to CAnimalImpl , whose signature mimics that of CAnimal :
class CAnimapImp
{
virtual void method1()=0;
...
virtual int methodn(...)=0;
};
class CDog: public CAnimalImp
{
...
};
... Now, you have the ability to turn a dog into a cat simply by calling setImpl . Some details remain to make this robust, like for instance deciding whose responsibility it is to destroy CAnimalImpl s, and define proper copy constructors.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Very interesting!
This could be what I'm looking for. But it doesn't look dead simple and straightforward, if I may say. There wil be some searches with "letter/envelope" as keyword during the weekend.
But thanks alot!
Haakon.
|
|
|
|