|
I'm curious why your program would care whether it was 8.3 or LFN. Most file I/O functions will work with LFN and all of them will work with 8.3 format.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
You should wrap the %1 in the registration data in quote marks. You should also put your program's path in quote marks. For example:
"C:\Program Files\IncludeProg\MyProgName.exe" "%1"
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
that is why i got the trouble.
u sure it passes full-path to app other than 8.3 format?
includeh10
|
|
|
|
|
Hello,
I have a GUI application where the user can set the background color for a plotting control.
My question is how to select a foreground(text) color that will "contrast" with the user selected background?
COLORREF bg = GetUserPlotColor();
COLORREF fg = F(bg);
That is, what is the code for the F() body?
TIA.
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
I'm no colour expert, but I did encounter this while writing a custom-drawn tree control a while back.
Have a look at this[^] article that should point you in the right direction.
However, in the end I think I settled for a simple XOR technique, where I XOR'ed my selection colour with white (#FFFFFF), to get the corresponding contrasting text colour. This is definitely the easy route, and will probably give unsatisfactory results on certain colours, but it works for me.
By the way, I found this[^] little web applet useful.
I Dream of Absolute Zero
|
|
|
|
|
I have played around a bit with inverting frame-grabbed images, and I found that the XOR technique usually works nicely.
Where it will not work well is with grey-scales which are close to mid-range, for example, if you have RGB-15 (5-bits of each colour, high order bit unused), where the R, G, and B values are all half-range = 15 decimal, i.e. the pixel is 0011 1101 1110 1111, XORing will give 1100 0010 0001 0000, i.e R, G, and B are all 10000 binary = 16 decimal.
For cases like this, the XORed text will be very difficult to make out.
To get around this, you could saturate (force to maximum or minimum) each colour component, then XOR / invert the result. For my example, the 15 decimal component values are forced to 0, then inverted to give 11111 binary, which should be visible.
|
|
|
|
|
This is an old function that generated a suitable shadow color for drawing 3D elements. If you reverese it, it should do what you want:
COLORREF MakeShadowColor(COLORREF rgbColor)
{
COLORREF rgbRetval;
if (rgbColor == RGB(255,255,128))
{
rgbRetval = RGB(128,128,0);
}
else if (rgbColor == RGB(192,192,192))
{
rgbRetval = RGB(128,128,128);
}
else if (rgbColor == RGB(128,255,255))
{
rgbRetval = RGB(0,0,255);
}
else if (rgbColor == RGB(0,0,0))
{
rgbRetval = RGB(128,128,128);
}
else
{
short iR = (GetRValue(rgbColor)+1)/2;
short iG = (GetGValue(rgbColor)+1)/2;
short iB = (GetBValue(rgbColor)+1)/2;
rgbRetval = RGB(iR,iG,iB);
}
return rgbRetval;
}
<pre>
<span style="background-color: rgba(255, 255, 0, 1); color: rgba(0, 128, 0, 1); font-family: Verdana, Arial; font-size: 8pt; font-style: italic"> onwards and upwards... </span>
|
|
|
|
|
Firstly I'd like to say that English is not my native language, so don't be angry with my mistakes.
I have a following problem.
I have writen program in c++ and now I'm working on making GUI. I do MFC Dialog based application. The problem is with edit box. My program do lots of iteration (~20.000). After each iteration I want to have printed number of iteration and values of some variables. this way in multiline edit box i want to have some kind of raport. I maneged to do it but i think my solution is not optimal and proper. i have simply added CString variable to EditBox and in each iteration I add temporary String refering to current iteration to whole string variable. It looks like this:
/*CString mWholeString
CString mTmpString -these are examle variables*/
mWholeString+=mTmpString;
and after finishing all interation i do UpdatData(FALSE).
It works but I think that it works slowly and there may be batter solution. Is this possible to print text like in console application e.g. create array of CString and print it in edit box using for loop?
I thank in advance for any direction.
|
|
|
|
|
You could possibly write your own output window. If you don't need editing of it, this would be a good solution that you could make run a lot faster. Just inherit directly from CWnd or CView and use the CDC::TextOut function.
-- Rocky Dean Pulley
|
|
|
|
|
This is probably going to be a tad better solution.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Hi
Is it possible to call a c# dll from an unmanaged code writen using VC 7?
Thanks in advance.
|
|
|
|
|
If you register the DLL with COM, yes: you can use #import in C++ to import the type library generated by regasm .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Can you point me some article/tutorial that explain how to do this?
Thanks.
|
|
|
|
|
Hi
I have a control that can either be created dynamically (using CWnd::Create()) or is created directly by windows when placed on a dialog using the dialog editor.
In both cases PreSubclassWindow is called by the framework, which I then use to initialize the control. I don't use OnCreate to do the intialization as OnCreate is not called when the control sits inside a dialog. My Initialzation function which is called from PreSubclassWindow creates other child controls used by my control. Everything works out well when the control is created as part of a dialog control, but everything seems to fall apart when creating my control dynamically using CMyControl::Create(...);
Having stepped through the creation code, windows always calls CWnd::Attach twice when creating dynamically, with the second call to Attach causing the debug assertion as the controls window is already attached the first time around.
Anyone got any ideas about whats going here whith a pssible solution?
Thanks
Garth
|
|
|
|
|
Hi Garth
The question you pose is an interesting one. In fact all the questions you've asked are quite amazing. You're either incredibly clever or supremely (?) stupid as no one on this forum has ever answered you're questions. Anyway let me have a crack at it.
Create a method, call it say, Initialize() which creates all the child windows etc.
Override Create a method CMyControl::Create() which clients must call when creating your control dynamically. Add a BOOL property (member variable) to the control, call it say 'm_bIsDynCreate', and set it to FALSE in constructor of the control. Now in your custom Create() function, set this variable to TRUE, call the base Create method e.g. CWnd::Create(...) and then call your intialize method. In your Overriden PreSubclass method, test 'm_bIsDynCreate'. If it is FALSE, call Initialize(..), otherwise don't, as it will have already been called when creating the control dynamically. When called as part of the creating cycle of a dialog, it will be called in PreSubclass window.
Here is some source code for your perusal.
<br />
BOOL CGarthsCtrl::Create(const RECT & rect,CWnd* pParentWnd,UINT nID,DWORD dwStyle)<br />
{<br />
m_bIsDynCreate=TRUE;<br />
if(!CWnd::Create("GARTHSCTRL",NULL,dwStyle|CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW,rect,pParentWnd,nID))<br />
return FALSE;<br />
Initialize();<br />
<br />
return TRUE;<br />
<br />
}<br />
<br />
void CGarthsCtrl::PreSubclassWindow()<br />
{<br />
CWnd::PreSubclassWindow();<br />
if(m_bIsDynCreate==FALSE)<br />
Initialize();<br />
<br />
}<br />
Funnily enough, Garth, I was experiencing just the same problem this afternoon. Talk about coincidences.
Anyway I hope this helps you somewhat.
Regards
Garth
|
|
|
|
|
Thanks Garth
You're solution is, to say the least, very elegant and masterfull.
Excellent.
It's solved all my problems. (I'm still having a cash flow problem though
Regards
Garth
|
|
|
|
|
Garth Watkins wrote:
You're solution is, to say the least, very elegant and masterfull.
Excellent.
It's solved all my problems
There is No Doubt your are Genius
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi guys
I've got a Doc-View app and from the view I open a CDialog.
What I want to do is to open my child CDialog to an absolute position from the screen.
What I have to use and what parameters I have to put in?
I've tried MoveWindow and set window pos without succes.
Thanks in forwarding
Doc
|
|
|
|
|
try the CWnd::SetWindowPos() fuction
regards,
Rajesh
|
|
|
|
|
Thanks guy, but what's the first parameter in SetWindowPos.
I've just want to move the dialog.
Best Regards
Doc
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/setwindowpos.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wcemfc4/html/aflrfcwndcolcolsetwindowpos.asp
-.-
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I wrote
"I've tried MoveWindow and setwindowpos without succes."
Already read msdn link, but not working , maybe something wrong in my parameters?
I don't now, but sorry a MSDN link won't help.An example will help a lot.
Doc
|
|
|
|
|
If you are using CWnd::SetWindowPos() the first parameter can be set to NULL.
Using the API ::SetWindowPos() the first parameter is the handle to the window to move.
e.g.
SetWindowPos(NULL, nLeft, nTop, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
<p></p>
where
nLeft and nTop - specify the top left corner of the window or
::SetWindowPos(hWnd, NULL, nLeft, nTop, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
<p></p>
where
hWnd - is the handle to the dialog window
nLeft and nTop - specify the top left corner of the window
NOTE: We do not need to specify the width and height if we have SWP_NOSIZE.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
|