|
|
Does it have a "\0" as end of string too?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
use strncpy() and restrict it to 20 characters. then, force the last char of the buffer to be a '\0'
|
|
|
|
|
Hi all masters I want to access c drive of other system and I use
\\systemname\\$c it ask for password and username even I enter right username and password of other system it dos not show c drive the popup window pops again and again ?
So please tell me if there is another way to access c drive of other system
thanks
|
|
|
|
|
p_ wrote: \\systemname\\$c
Its \\SystemName\C$
Regards,
Paresh.
|
|
|
|
|
hi all,
have u know about, how to insert buttons in tool bar.
if you know , please help me
thanks
panthal
|
|
|
|
|
Search in MSDN.
Also please look at this[^].
Regards,
Paresh.
|
|
|
|
|
are you talking about inserting buttons to the toolbar of an sdi application?
if so,
then you have to go to resource view tab,expand toolbar,click on IDR_MAINFRAME, and then add now button there.
any more clarifications?
welcome.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
hi,
there is no option to insert buttons in resource view
i used this code to insert a button, but i 'am in need to have 4 buttons, that was not working.
int mWidth = 125;
int mHeight = 25;
m_wndToolBar.SetButtonInfo(14, IDC_EMPBAPPLY, TBBS_SEPARATOR,mWidth);
CRect rect;
m_wndToolBar.GetItemRect(14, &rect);
rect.bottom = rect.top + mHeight;
CString Etext = "Employee";
m_EMPBApply.Create(Etext, WS_VISIBLE, rect, this, IDC_EMPBAPPLY);
thanks
panthal
|
|
|
|
|
My wanted function:
when I click a button to pop up the CFontDialog and choose the font. Then A EDIT control use this font to show and edit texts in it.
My codes: (not working)
void CMyDialog::OnSelFontButton()
{
CFontDialog dlg;
if (dlg.DoModal() == IDOK)
{
CString strFace = dlg.GetFaceName();
int iFontSize = dlg.GetFontSize();
LOGFONT lf = {0};
lf.lfWeight = iFontSize;
_tcscpy(lf.lfFaceName, strFace);
CFont cfont;
cfont.CreateIndirectFont(&lf);
CDC *pdc = m_MYEDITCTL.GetDC();
pdc->SelectObject(&cfont);
m_MYEDITCTL.ReleaseDC(pdc);
}
}
and I try to use CEdit::SetFont, Not working also.
|
|
|
|
|
This is not the way to set the font.
You have to do as,
m_MYEDITCTL.SetFont( m_font );
Where you have to make the font object global, static, or member of CMyDialog.
-- modified at 0:32 Friday 2nd November, 2007
- NS -
|
|
|
|
|
I define a winapp life m_font, a public data member of my derived CWinApp class,
But in the method
void CMyDialog::OnSelFontButton()
{
CFontDialog dlg;
if (dlg.DoModal() == IDOK)
{
CString strFace = dlg.GetFaceName();
int iFontSize = dlg.GetFontSize();
LOGFONT lf = {0};
lf.lfWeight = iFontSize;
_tcscpy(lf.lfFaceName, strFace);
<FAILED> theApp.m_font.CreateIndirectFont(&lf);
m_MYEDITCTL.SetFont(&theApp.m_font);
}
}
when I choose the font in the second time, I face a ASSERTION failure in the place <FAILED>. And I also tried a global definition, it failed in the same place too. Someone tell me why?
|
|
|
|
|
fantasy1215 wrote: when I choose the font in the second time, I face a ASSERTION failure in the place <failed>.
What line of what file is asserting?
"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
|
|
|
|
|
Does this line has error? theApp.m_font.CreateIndirectFont(&lf); ?
|
|
|
|
|
This line doesn't have compile error.
But when running the exe, it faces the ASSERTION.
When I debug to trace, find the ASSERTION failed line is in that place.
|
|
|
|
|
Well I am running your code and its working (I checked bor button) but I have two questions:
(1)did you check return value of CreateFontIndirect what was it?
(2)You said SetFont doesnt work it has two arguments second parameter is for redraw did you use of default(true)
|
|
|
|
|
Sorry if this is the wrong place to post this...
I am writing a mini-filter which needs to open files before they are
deleted. I am filtering on _MJ_CLOSE and then checking the
DeletePending flag on the associated FILE_OBJECT. I need to open the
file for write access to wipe the contents, but no matter what I have
tried I always get a status STATUS_DELETE_PENDING from the Open
function. I have tried FltCreateFile, ZwCreateFile & IoCreateFile.
Can anyone shed some light on how this might be accomplished?
Thanks very much!
John
|
|
|
|
|
What is the accepted way to stop a thread from waiting on the ConnectNamedPipe() function?
I have tried terminating the thread with TerminateThread, and I have tried sending the pipe a special "terminate" message so that the thread can exit by itself.
But what is the accepted method?
|
|
|
|
|
Closing the handle may do it.
I personally like using overlapped I/O with events.
There's an example here: one Use for Overlapped I/O[^]
(see the section "Overlapped I/O Usage")
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks again, Mark. I see I'm not the first who ran up against this dilemma.
The overlapped method is brilliant in its simplicity. There is no need to call GetOverlappedResult() because we only need to know that the event has occurred!
|
|
|
|
|
Independent123 wrote: The overlapped method is brilliant in its simplicity. There is no need to call GetOverlappedResult() because we only need to know that the event has occurred!
Yeah, I like that I don't like any blocking functions - I want total control!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It was already answered, but don't try TerminateThread.. causes leaks most of the time. Properly signal the thread and close it from the inside to properly release your resources.
|
|
|
|
|
I'm trying to pass a pointer to a function as an argument to another function, but I am getting compile errors.
class CModule : public CDialog
{
public:
CModule (CWnd* pParent = NULL);
...
private:
unsigned char FunctTask1(unsigned char, unsigned char);
unsigned char FunctTask2(unsigned char, unsigned char);
unsigned char FunctTask3(unsigned char, unsigned char);
void ManageTasks(unsigned char, unsigned char, unsigned char (*)(unsigned char, unsigned char));
};
unsigned char CModule ::FunctTask1(unsigned char Param1, unsigned char Param2)
{
...
}
unsigned char CModule ::FunctTask1(unsigned char Param1, unsigned char Param2)
{
...
}
unsigned char CModule ::FunctTask1(unsigned char Param1, unsigned char Param2)
{
...
}
void CModule ::ManageTasks(unsigned char Param1, unsigned char Param2, unsigned char (*ptrFunct)(unsigned char, unsigned char)
{
...
switch (ptrFunction(1,1))
{
case 0:
case 1:
}
...
}
now based on a combobox selection, I will call a different function
void CModule::OnSelchangeCombobox()
{
switch(m_Combobox->GetCurSel())
{
case 0: ManageTask(1,1,FunctTask1); break;
case 1: ManageTask(1,1,FunctTask2); break;
case 2: ManageTask(1,1,FunctTask3); break;
}
}
but i get this error on compile
'ManageTasks' : cannot convert parameter 3 from 'unsigned char (unsigned char,unsigned char)' to 'unsigned char (__cdec<br />
l *)(unsigned char,unsigned char)'
What am I doing wrong? FYI I'm using VC++ 6.0.
|
|
|
|
|
acerunner316 wrote: What am I doing wrong?
From a quick glance at your code: you are trying to pass a pointer to a member-function where a pointer to a function is expected
|
|
|
|
|
so i have to specify in the argument list of 'ManageTasks' to expect a member function and not a regular function?
How do I do that?
|
|
|
|