|
But why the following is not working for a very simple dialog box app:
UINT CSasaDlg::OnNcHitTest(CPoint point)
{
UINT hittest = CDialog::OnNcHitTest(point);
switch(hittest)
{
case HTRIGHT:
AfxMessageBox("Hurray! you click right side");
}
return hittest;
}
|
|
|
|
|
Because you will not get a HTRIGHT status for a dialog with a non-resizable border. You will only get the HTRIGHT, HTLEFT, HTTOP, HTBOTTOM and all of the combinations in between for a window with a resizable border.
If you change the HTRIGHT to HTBORDER, you will see it work.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Does anyone know the answer to this one.
I have a CListCtrl and I want to make the rows different colours.
Can I do this without making it Owner draw? i.e just using SetTextColor
When I insert the items at the moment, all of them are the same colour even though I make multiple calls to the SetTextColor function with different RGB value.
Please could someone help.
Really appreciate it.
Richard
|
|
|
|
|
You have to use owner draw, SetTextColor works for the whole list, there's no item index parameter. it's not that hard to use owner draw, if you only want to change the color of an item.
There might be someone who already create a CListCtrl derived control that do that, did you check here on CodeProject ?
Max.
|
|
|
|
|
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
|
|
|
|