|
Now u are able to call the remove() successfully, Isn't it.
What you are trying to achieve? i already told change the read only attribute before remove().
_chmod() / SetFileAttributes() to change the readonly attributes.
If you want to lock a file, LockFile() / _locking()/_lock_file() API is there.
|
|
|
|
|
Hi,
I have changed the background color of my CToolBar. Now I would like to change the background color CToolBar's parent window which is AfxControlBar*. How could I do this ?
Any help would be appreciated.
Thanks,
Paresh
|
|
|
|
|
What exactly you trying to do??
Anyways simple way to change background color is Handle WM_CTLCOLOR message and return a brush of new color.
|
|
|
|
|
Hi Sandip,
I want to paint the background color of the CToolbar. However, I am able to paint only the area which belongs to CToolbar and not the AfxControlBar, which is the parent of CToolbar. (though we have a m_wndToolbar as a member of CMainFrm).
I hope you understand the issue.
Regards,
Paresh.
|
|
|
|
|
dear all
i would like to generate several different Gaussian function according to different sigma,and then can determine x and y value(ie. bound), and then it can determine the size of Gaussian mask. the formula is below: it is Gaussian function: g(x,y)=1/2*3.14*exp(-(pow(x,2)+pow(y,2)))/2*pow(sigma,2)
thanks a lot.
Li Zhiyuan
|
|
|
|
|
I want to continuously poll one of the pins of my parallel port for activity. I've written a function to do this, but I can't find where to call the function. Every place I place the function call, it executes before my SDI page appears. I want to use an SDI environment so I can print out the data stream detected on the port pin. How do I implement my function???? Signed/Confused!
|
|
|
|
|
Does your function contain the polling loop or does it need to be called periodically?
If the function contains the loop, then your UI is never going to appear unless you provide a way for
messages to get dispatched to windows.
You could put your loop on a separate thread. Note that a "busy" loop will consume nearly all your CPU...
not very friendly to UI of your app or other apps.
You could also use a timer and periodically poll instead of using all the CPU polling.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the reply!
If I use a Timer in an SDI application, how would I implement it in the Document, which is where I assume it would have to go? I'm having trouble defining the first parameter of the SetTimer() function (asking for a handle to the window).[ I consider myself an Intermediate programmer, but I haven't worked much with SDI; only Dialog-based apps. ]
|
|
|
|
|
A window timer will need a window, so the view class is a better place to implement that type of timer.
For better timer resolution, and without a window, you can use a multimedia timer.
timeBeginPeriod()/timeSetEvent()/timeKillEvent()/timeEndPeriod() are the multimedia timer
functions you'd need. A multimedia timer can periodically call a callback function or set/signal
an event - way more flexible than a window timer.
Note that multimedia timer events/callbacks occur on a different thread, so if in response to the
timer you need to mess with UI, you'll need to synchronize access to UI/GDI with the app's UI thread.
Here's an example...
<font color="Green">
UINT wTimerRes = 0;
MMRESULT mmTimerId = 0;
static void CALLBACK MyTimerProc(UINT, UINT, DWORD_PTR dwUser, DWORD_PTR, DWORD_PTR);
void StartTimer();
void StopTimer();
<font color="Green">
CMyDocumentClass::CMyDocumentClass()
{
UINT wTimerRes = 0;
MMRESULT mmTimerId = 0;
}
void CMyDocumentClass::StartTimer()
{
TIMECAPS tc;
if (::timeGetDevCaps(&tc, sizeof(TIMECAPS)) == TIMERR_NOERROR)
{
<font color="Green">
wTimerRes = min(max(tc.wPeriodMin, 1), tc.wPeriodMax);
::timeBeginPeriod(wTimerRes);
<font color="Green">
mmTimerId = ::timeSetEvent(100, wTimerRes, &CMyDocumentClass::MyTimerProc, (DWORD_PTR)this,
TIME_PERIODIC | TIME_CALLBACK_FUNCTION);
}
}
void CMyDocumentClass::StopTimer()
{
if (mmTimerId)
{
::timeKillEvent(mmTimerId);
mmTimerId = 0;
::timeEndPeriod(wTimerRes);
wTimerRes = 0;
}
}
void CALLBACK CMyDocumentClass::MyTimerProc(UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR)
{
CMyDocumentClass *pThis = (CMyDocumentClass *)dwUser;
<font color="Green">
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Is there a way for your program to tell the list view control what height you want items to be in detail/report mode? The only immediate solution I see is to assign the list view small image list with a list that has the dimensions you want. Is there some way to do this by handling some LVN_XXX message (or something like that)?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
I'm working exactly in the same thing!!!
First I used LVM_GETITEMRECT message, but the items height are always 17 in report mode. Even if they have a larger icon. In my case small images are 32x32 and item heights are 33.
rotter
|
|
|
|
|
Just a guess, but I think you may need to use the LVS_OWNERDRAWFIXED style.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The row height is the greater of the height of a row of text and the height of the image list, plus a couple pixels for padding. As David said, if you need precise control, you'll need to use owner draw.
|
|
|
|
|
template <class t=""> <br />
class CProtectedVariable <br />
{<br />
CProtectedVariable()<br />
{<br />
} ; <br />
<br />
~CProtectedVariable()<br />
{<br />
}<br />
<br />
protected :<br />
T m_Var ; <br />
<br />
} ; </class>
when i do this and include this another class as a member. I am getting a few compiler errors
#include "Protected.h" <br />
class OutSideClass <br />
{<br />
protected :<br />
CProtectedVariable<bool> m_initState ; <br />
};</bool>
error C2248: 'CProtectedVariable<t>::CProtectedVariable' : cannot access private member declared in class 'CProtectedVariable<t>'<br />
1> with<br />
1> [<br />
1> T=bool<br />
1> ]</t></t>
What am I missing here ?
Engineering is the effort !
|
|
|
|
|
OutSideClass cannot instantiate its m_initState member because CProtectedVariable constructor is private (private is the default access specifier for a class). You may change
template <class T>
class CProtectedVariable
{
CProtectedVariable()
..
};
into
template <class T>
class CProtectedVariable
{
public:
CProtectedVariable()
..
};
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
ahh that was silly. Sorry for bothering u guys . Never thought it was an access issue !
Engineering is the effort !
|
|
|
|
|
act_x wrote: What am I missing here ?
Code inside of <> brackets. Remove the < bracket and click the < button above the smileys instead.
You might also consider using <pre> instead of <code>, too.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I am using the mschart C++ charting control. And I was looking to format a regression line for the chart- currently, it only allows me to display the linear regression stat-line.
Is there a way to customise the trend-line to be logarithmic, and display the equation on chart ?
Thanks,
Mukund
|
|
|
|
|
Any idea/trick to Access m_nIDHelp (resource Id) of active dialog from CMainFrame class.
Able to get the handle of active window but unable to access m_nIDHelp, since it is protected in the base class CDialog.
pls let me know incase u have something regarding this
Thanks..
|
|
|
|
|
Why don't you inherit CDialog?
If it's protected you can access it from a member function of a derived class.
rotter
|
|
|
|
|
Thank you for your responce,
ya we can do that, But I am Iooking for some working around, with out distrubing the dervied class,
Getting it from active window handle, from MainFram.. I belive I am a bit clear now..
Thanks
|
|
|
|
|
I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup
how to avoid this .
Thanks in advance
|
|
|
|
|
vicky00000 wrote: I Used ShowWindow(SW_HIDE) it hide the dialog but at the inital it popup
how to avoid this
According to MSDN, the SW_HIDE is ignored during the 1st call when the dialog is about to pop up.
ShowWindow[^]
The first time an application calls ShowWindow, it should use the WinMain function's nCmdShow parameter as its nCmdShow parameter. Subsequent calls to ShowWindow must use one of the values in the given list, instead of the one specified by the WinMain function's nCmdShow parameter.
As noted in the discussion of the nCmdShow parameter, the nCmdShow value is ignored in the first call to ShowWindow if the program that launched the application specifies startup information in the structure. In this case, ShowWindow uses the information specified in the STARTUPINFO structure to show the window.
Maxwell Chen
|
|
|
|
|
Is there any way to update STARTUPINFO structure ?
Thanks for your replay
|
|
|
|
|
And the reason is: If it worked, then no target window would receive messages.
There is a solution for this: To make your application hide to systray.
Maxwell Chen
|
|
|
|