|
I want to rename a directory which is not empty.But I met a very strange problem.The function run well sometime and failed sometimes?
Whe it is failed,there will be a shared error.how can I resolved it?I am eager to do this job.Thank you very much.
I am I,Who is who,I am who,Who am I
|
|
|
|
|
I suspect a program may be accessing a file or more in that directory.
Kuphryn
|
|
|
|
|
am a newby to c++ and need to write a program with a 1-D array that generates random numbers. the users must be able to specify the number of random number (is this possible?) and the program must then generate "x" random numbers (negative numbers included). any help would be truly appreciated.
cheers
|
|
|
|
|
Sounds like you want to generate a list of radom numbers given a user supplied size.
#include "stdlib.h"
int* CreateArrayOfRadomNumbers(int nSize)
{
int* pArray = new int[nSize];
if( NULL == pArray )
return NULL;
for( int i=0; i<nsize; ++i="" )
="" {
="" parray[i]="rand();
" }
="" return="" parray;
}
<pre\="">
|
|
|
|
|
Just remember to be sure to delete your array when you're don as to avoid any memory leaks!!!
i.e.
void foo()
{
int* myArray = CreateArrayOfRadomNumbers(12);
delete[] myArray;
}
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I think you just did his homework for him
Gary Kirkham
A working Program is one that has only unobserved bugs
I thought I wanted a career, turns out I just wanted paychecks
|
|
|
|
|
thank you so much.. i am truly in your debt..
"It has something to do with luck, a lot to do with our grit and our fight, but for whatever reason, we're a tough team to put out," - Kobe Bryant, LA Lakers..
|
|
|
|
|
Hello,
I'm working on a project that has an About box with a System Info tab. The current code to retrieve Windows version is a few years out of date, and only covers 3.1, 95, 98, and NT; my XP shows up as NT. How can I update this to also correctly show Me, 2000, and XP?
Thanks!
Elisabeth
-----
CString str, str2, str3;
char szBuf[100];
DWORD dwPlatform, dwMajor, dwMinor;
m_sysinfo.GetWindowsVersion( &dwPlatform, &dwMajor, &dwMinor );
str = "";
switch( dwPlatform )
{
case VER_PLATFORM_WIN32s:
str += "Win32s on Windows 3.1 ";
break;
case VER_PLATFORM_WIN32_WINDOWS:
str += "Windows ";
if( dwMinor == 0 )
{
str += "95 ";
BOOL bVal = 0;
m_sysinfo.IsOSR2( &bVal );
if( bVal )
{
str += "OSR2 ";
}
}
else if( dwMinor == 1 )
str += "98 ";
break;
case VER_PLATFORM_WIN32_NT:
{
str += "Windows NT ";
BOOL bVal = 0;
m_sysinfo.IsNTServer( &bVal );
if( bVal )
{
str += "Server ";
}
}
break;
default:
str += "Unknown ";
}
|
|
|
|
|
|
|
|
at the release of VS.NET 2003 they demo'd how you could use the IDE form editor with C++ projects now, including all that cool anchoring stuff. My understanding is that this is only available for managed C++ projects, not for MFC. Is this right?
|
|
|
|
|
Unfortunately, that is true. But you can use unmanaged code in a managed project. I haven't gotten into that yet.
Do Lipton employees get coffee breaks?
|
|
|
|
|
Hello...I have a form with some edit controls boxes and buttons. There are two modes (1 and 2). In mode 1 some edits controls should be available for editing, and a button visible and available; and other controls should be unavailable for editing and another button not visible.
Changing to mode 2 invert the availability.
My problem is that I do not know if this is possible to do it at runtime. If this is possible, how do I do it?
I know where to put the code to enable and unenable the controls, but I would like to know what are the visual c++ statements to do this.
Can anyone give me a hand?
What I meant is how can I change the edit control styles and button control styles, specifically WS_TABSTOP and WM_ENABLE? This at run time
Thanks
Eric Manuel Rosales Pena Alfaro
PhD student
Unversity of Essex
Wivenhoe Park
Colchester, CO4 3SQ
Essex, Uk
email: emrosa@essex.ac.uk
tel: +44-01206-87311
|
|
|
|
|
EnableWindow() // TRUE or FALSE (controls are windows)
ShowWindow() // SW_SHOW or SW_HIDE
Trust in the code Luke. Yea right!
|
|
|
|
|
Your_Control.EnableWindow(1) ->Enables control in run time
put the arg to 0 to disable..
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
Hi there,
I'm having a problem with the WSAAccept() command on MSVC 6.0, using ws2_32.dll. Using the code below (before calling listen) it goes something like:
bind() etc...
int setsockopt(mySock,SOL_SOCKET,SO_CONDITIONAL_ACCEPT, (const char*) val, sizeof (val));
listen()...
The problem is that it just won't compile, I've tried changing the version, using winsock1 etc. The compiler just doesn't recognise the function call, like it isn't in winsock2, but I know from a Microsoft book ("Writing Secure Code") that it is. I'm very confused!?!
Once again thankyou in adv.
noxon
|
|
|
|
|
are you linked with ws2_32.lib..???
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
OK, I am newbie, writing a MFC SDI-app, and I want to write text to my view.
Besides the text, there is a lot of drawing in the view, primarily lines and rectangles which I draw, basically this way:
<br />
CClientDC ClientDC(this);<br />
CRect area;<br />
<br />
area.SetRect( 10, 10, 250, 400);<br />
DrawRectangle(&ClientDC, area, 2);<br />
<br />
area.SetRect( 10, 10, 40, 399);<br />
DrawRectangle(&ClientDC, area, 1);<br />
<br />
...<br />
And DrawRectangle is the following:
<br />
void CITPAView::DrawRectangle(CDC *pdc, CRect rect, int width)<br />
{<br />
COLORREF penn, bakgrunn;<br />
penn = RGB(0, 0, 0);<br />
bakgrunn = RGB( 255, 255, 255);<br />
<br />
CBrush Pensel( bakgrunn);<br />
CPen Penn( PS_SOLID, width, penn);<br />
<br />
pdc->SelectObject(&Penn);<br />
pdc->SelectObject(&Pensel);<br />
<br />
pdc->MoveTo( rect.left, rect.top);<br />
pdc->Rectangle( rect.left, rect.top, rect.right, rect.bottom);<br />
}<br />
This drawing works just fine as far as I can see, but it gets me to another question:
- Memory cleanup, how should I go about here? And if anyone got a more efficient way to do this, go right ahead and tell me, please!
I have found out how to write plain text with the CDC-class, but how do I output it in a certain angle? Is there some smart way to do this?
------------------------------
The great successful men of the world have used their imagination...they think ahead and create their mental picture in all its details, filling in here, adding a little there, altering this a bit and that a bit, but steadily building-steadily buildings. (Robert Collier)
|
|
|
|
|
OldViking wrote:
I have found out how to write plain text with the CDC-class, but how do I output it in a certain angle? Is there some smart way to do this?
Use the Escapement member of the font to set the angle in degrees, starting from ->straight left.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
How do I set up a message handler that notifies my dialog application that a byte has hit the serial port? I have been given the website:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
but I only leave this site more confused as I did before.
My Serial read functions are working great when in a loop, but I need my application to remain event driven.
Thanks
Kevin Shaffer
Student of Computer Science
University of Kansas
kshaff03@msn.com
|
|
|
|
|
You could use PostMessage() to send a user defined message to the app. I assume the serial port stuff is running in a thread. Also have a look at articles here on CP re. serial ports.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
You need to have a second thread in your application that checks for events. I am not sure if the website that you are listing is the same that I have looked at 3 years ago but if it is, they list all the functions needed. The main problem is that you need to have a thread that checks your port.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I have a client who is installing an NT Service on a W2K server in a Novell network. The can install but are unable to start the service. I don't have any Novell experience...yet!
My gut reaction is that Novell may require the user the service runs under to have some special permissions. Any ideas or guidence on where to look to solve this?
Thanks,
ed
Regulation is the substitution of error for chance.
|
|
|
|
|
Does anyone know how to automatically perform a funcion when a dialog appears, such that in the function you can update an edit control and the user can see the update? I basically need to perform a function when the dialog is loaded, and throughout the function it sends updates to an edit box to display the status of the function. I tried placing a call to the function in OnInitDialog() but the dialog doesn't paint until after the function has returned. Does anyone know how to do this?
|
|
|
|