|
how can I change the color of status bar with vc6? I mean the bottom of the window.Thanks a lot.
hi all
|
|
|
|
|
How can I make a property in an ActiveX control (ATL) have the choices enumerated so that they appear as a drop-down list in VB?
Thanks,
Jory
|
|
|
|
|
Okay, just to maybe save someone else some time in the future, I get a RPC_X_BAD_STUB_DATA (1783) windows error code if I pass a buffer that is too LARGE into this function. When I reduced it to 4096 bytes, the call works fine.
|
|
|
|
|
Hey,
When I print on a normal Printer, all the text prints fine, but when I have it print on a Laser Printer, all the text gets squahsed together, and text is wirrten over other text, it is a whole mess. Anyone know why it is doing it?
Here is the code.
<br />
<br />
CPrintDialog dlg(FALSE); <br />
CDC dc; <br />
#if 0 //Show print dialog. <br />
if (dlg.DoModal() == IDCANCEL) <br />
return; <br />
dc.Attach(dlg.GetPrinterDC());<br />
#else //Don't show print dialog. <br />
PRINTDLG prtDlg; <br />
AfxGetApp()->GetPrinterDeviceDefaults(&prtDlg);
dlg.m_pd.hDevMode = prtDlg.hDevMode; <br />
dlg.m_pd.hDevNames = prtDlg.hDevNames; <br />
dc.Attach(dlg.CreatePrinterDC());<br />
#endif <br />
dc.m_bPrinting = TRUE;
CRect printArea; <br />
CRect printArea1; <br />
CRect printArea2; <br />
CRect printArea3; <br />
CRect printArea4; <br />
CRect printArea5;<br />
CRect printArea6; <br />
CRect printArea7; <br />
<br />
printArea.SetRect(500, 0, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea1.SetRect(700, 1500, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea2.SetRect(750, 1750, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea3.SetRect(1250, 1750, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea4.SetRect(750, 1825, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea5.SetRect(1250, 1825, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea6.SetRect(325, 250, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
printArea7.SetRect(750, 500, dc.GetDeviceCaps(HORZRES), dc.GetDeviceCaps(VERTRES));
DOCINFO docinfo; <br />
memset(&docinfo, 0, sizeof(docinfo)); <br />
docinfo.cbSize = sizeof(docinfo); <br />
docinfo.lpszDocName = _T("Edit Control Print"); <br />
dc.StartDoc(&docinfo); <br />
dc.StartPage(); <br />
<br />
CFont font;<br />
font.CreatePointFont(480, "Arial", &dc);<br />
<br />
CFont font1;<br />
font1.CreatePointFont(280, "Arial", &dc);<br />
<br />
CString str("Text Text Text");<br />
CString str1;<br />
CString str2("Test");<br />
CString str3("Test");<br />
CString str4;<br />
CString str5;<br />
CString str6("Test");<br />
CString str7("Test");<br />
<br />
CSize size = dc.GetTextExtent(str);<br />
CFont *pOldFont = dc.SelectObject(&font);<br />
dc.DrawText(str, printArea, DT_NOPREFIX | DT_WORDBREAK);<br />
dc.DrawText(str6, printArea6, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.DrawText(str7, printArea7, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.SelectObject(pOldFont);<br />
<br />
<br />
m_name.GetWindowText(str1);<br />
CSize size1 = dc.GetTextExtent(str1);<br />
CFont *pOldFont1 = dc.SelectObject(&font1);<br />
dc.DrawText(str1, printArea1, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.SelectObject(pOldFont1);<br />
dc.DrawText(str2, printArea2, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.DrawText(str3, printArea3, DT_NOPREFIX | DT_WORDBREAK); <br />
<br />
m_DEPdate.GetWindowText(str4);<br />
m_Shipdate.GetWindowText(str5);<br />
dc.DrawText(str4, printArea4, DT_NOPREFIX | DT_WORDBREAK); <br />
dc.DrawText(str5, printArea5, DT_NOPREFIX | DT_WORDBREAK); <br />
<br />
dc.EndPage(); <br />
dc.EndDoc();<br />
}<br />
<br />
After it printed weird on a Laer Printer I thught it was the code and tried it on anomral printer again, and it worked fine, so is printing on a lser printer something different on code?
Thanks for any help
|
|
|
|
|
You must take differences in printer resolution into consideration. Your printing rects have hardcoded coordinates, which is bad, bad, bad. To get the resolution for a single inch of the printer, call dc.GetDeviceCaps( LOGPIXELSX/LOGPIXELSY); . Use values based on the return for the start coordinates in your SetRect -calls.
|
|
|
|
|
I'm getting LNK Error 2005
nafxcwd.lib(afxinl1.obj) : error LNK2005: "public: virtual void __thiscall CObject::Serialize(class CArchive &" (?Serialize@CObject@@UAEXAAVCArchive@@@Z) already defined in mfc42ud.lib(MFC42uD.DLL)
It appears the conflict MAY be caused by a library file (I do not have source) included in Project/Settings/Link.
However, I've examined the functions in the link file and it does NOT appear that they are dups of the 100 functions listed in Output (Unicode functions) with the LNK 2005 error.
BACKGROUND
This is my first attempt at ActiveX. ActiveX appears to need Unicode. ActiveX being developed under Win98.
QUESTIONS:
Where do I go from here??????
Thanks
David
|
|
|
|
|
Are FSCTL_GET_NTFS_VOLUME_DATA and FSCTL_GET_RETRIEVAL_POINTERS0 valid as dwIoControlCode for DeviceIoControl() on NT4?
The reason I ask is that the Platform Documentation incdicates it is only available on Windows 2000 and XP. However, the include file "winioctl.h" indicates it is available on NT4 and above.
Which is true ?
Can someone verify it on NT4 please.
Thanks
|
|
|
|
|
I have this cd burning app that I have been working on.
I added a dialog to show progress along the way. Now
this dialog implements a interface and these methods
are called during the burn. (These methods are callbacks
that windows calls duriing the burn. So surely they are
called from a different thread) I added some members to
represent the controls on this dialog, 2 CStatics and
a CProgressCtrl. I added the DDX_Control stuff. Now
I know that I am not supposed to work with a control from
different threads other than the one it was created with.
If that is the case how do I set the window text and the
progress step from these methods?
Thank You
Bo Hunter
|
|
|
|
|
Instead of executing the callback methods, you might want to consider posting messages to the dialog. The message indicates a "progress event". The dialog would query the CD burning thread for its progress, in response to the message.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I'm having problems with VC++ 6 SP5 creating larger than normal Release Executables.
I've noticed it when compiling (in Release mode) a couple of projects:
1) ToDoList (www.codeproject.com/tools/ToDoList2.asp) - The official dll is 153KB, and mine is 202KB.
2) QCD Monkey's Audio input plugin (http://quinnware.com/bin/plugins/input/sup_QCDApeSrc.zip) - The official version is 340KB, and mine is 444KB.
I don't tamper with any of the configuration, and compile as it comes. All I do is make sure the Release Configuration is selected.
It has nothing to do with Optimizing for small size.
Everyone else I speak to has no problems producing the smaller dll/executable.
What is going on ? What is wrong with my compiler setup/compiler ?
Can anybody else re-create my problem ?
How do I "fix" it ?
Help!!!!!!!!!!
|
|
|
|
|
Is it possible to make a dll in C++ that VB can call to start functions on a thread? For instance, I'd like to get a recordset, divide by ten on the number of records, then call a DoThread() function from vb ten times, sending as the LPARAM the number in the recordset for the thread to start processing on so that all 10 threads could be running at the same time. Any help or comments would be greatly appreciated.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
you can create threads with vb only, too!
Don't try it, just do it!
|
|
|
|
|
That is entirely possible. In C++ you can start threads using the C++ runtime library functions beginthread and beginthreadex. Also available are the Win32 function CreateThread. There is also the MFC Class CWinThread and a global function named something like AfxBeginThread.
There are many articles on MSDN about thread creation in C++ here is just one:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_threads.asp[^]
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I have a function, from a third party library, that takes a variable number
of arguments, like so
int RealFunc(int var1, ...)
I have a define that I actually call to use this function, like so
#define StubFunc RealFunc
I need to change the define to more of a macro that would allow me to pass
the variable number of arguments to the macro and they gets passed to the
real func call with other functions being called in between, like this
#define StubFunc(int var1, ...) { \
CallOtherFunc() \
RealFunc(var1, ...) // Passing all arguments passed to the macro \
CallOtherFunc2() \
}
Can this be done? Any ideas?
|
|
|
|
|
wouldn't you prefer inline function instead of a macro ?
TOXCCT >>> GEII power
|
|
|
|
|
Inline function would be fine. How can I pass all the parameters to the RealFunc?
|
|
|
|
|
You can't do that in C++. One of the recent C standards (C98 I think) has variadic macros, but that feature hasn't been added to C++ (and it might not be anytime soon, given Stroustrup's and the standards committee's hatred of the preprocessor)
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
I thought that if done as an inline function, that since the variables are pushed on the stack, and havnt been pop'd off, that there might be a way to "pass" them through. Maybe with some assembly code.
|
|
|
|
|
If your compiler supports variable argument macros on C++ files, you can use the following:
#define StubFunc(arg...) { \
CallOtherFunc() \
RealFunc(arg) // Passing all arguments passed to the macro \
CallOtherFunc2() \
}
The GNU compiler supports this, but not too many other compilers support it.
|
|
|
|
|
If you click on the sliderbar with the mouse, it will move only one pagesize up/down. How can I change this behaviour, that clicking into a slider bar moves it to exactly that position like in WMPs Position-Ctrl?
Is there any simple way to achieve that?
Thanks for any answer
Konrad
|
|
|
|
|
search for some articles here on CodeProject about "Subclassing a control"...
TOXCCT >>> GEII power
|
|
|
|
|
Thanks for your answer. Isn't there any other simple way, than subclassing the control. I think I'm not the first one, who wants to achieve that behaviour. Isn't there a class out there I can use?
Konrad
|
|
|
|
|
Writing some code to allow an app to run correctly with right-to-left languages (e.g., Hewbrew, Arabic.)
For controls that need to be flipped (which is most, but not bitmaps and stuff like that), I add these styles:
WS_EX_LAYOUTRTL<br />
WS_EX_NOINHERITLAYOUT
My first try was to use SetWindowLong to set the style after the window was created.
This works like a champ in Windows 2000 and Windows XP. It doesn't work very well in Windows 98 - there are redraw problems. The windows stays gray until I move or resize, then controls get redrawn. If I do something like pop up a message box, it won't show up unless I open another app, and then switch back to my program!
After reading, I noticed that Microsoft says a lot of controls may not support changing this style at run-time, so I just pass the extended styles into CreateWindowEx . Same problems.
Any ideas? I could post code but it's pretty lengthy. I may play around some more and try to distill this into a small, simple GUI that breaks... but that's going to take some time.
Another note, I am trying this on an actual Windows Me Hebrew machine, as I know Windows Me English, switching to Hebrew, won't work.
I suppose I could do all the mirroring stuff myself, but that will suck. I'd like to avoid it if I can..
Thanks!
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
I have a custom file type for my application. When you click on one of these files it opens my application. I can put the path of the clicked file in the command line that Windows generates to open the application but where does this get passed to? How can I tell my application to open the file once it has happily opened itself?
I am using Visual C++ 6, MFC and a SDI with view/document.
If anyone knows how to do this please let me know as I am going crazy reading through useless MSDN pages.
|
|
|
|
|
check GetCommandLine() API
|
|
|
|
|