|
This works for me, I just tested it.
char string[103];
struct{
char fileStr[100];
}gList[100];
strcpy(gList[0].fileStr, "FileAtIndex0");
strcpy(gList[1].fileStr, "FileAtIndex1");
strcpy(gList[2].fileStr, "FileAtIndex2");
strcpy(gList[3].fileStr, "FileAtIndex3");
strcpy(gList[4].fileStr, "FileAtIndex4");
strcpy(gList[5].fileStr, "FileAtIndex5");
strcpy(gList[6].fileStr, "FileAtIndex6");
for (int i = 0; i < 5; i++) {
strcpy((char*)string,(char*)gList[i].fileStr);
strcat((char*)string," OK");
}
Are you sure your x doesn't get oout of bounds (is less than 100) ?
(Your debugger will tell you... )
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Check that none of your filenames are longer than 97 characters - any longer and your string will overflow, and random badness can happen
it'd be better if you changed your code to be
char string[MAX_PATH+4]; // space for a filename, plus " OK" plus null terminator
..
char fileStr[MAX_PATH];
MAX_PATH is defined to be the length of the longest legal filename+path in Windows
|
|
|
|
|
Programm3r wrote: strcpy((char*)string,(char*)gList[x].fileStr); strcat((char*)string," OK"); // Unhandled Exception
You only have room for 99 characters, plus a nul character, in string .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you all, found the problem...
Many thanx
Regards
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
|
Something that could be found easily by using the debugger, i guess...
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hi to all,
How to change the font of some Menu Items using VC6?
I want to make some menu items Bold. How to do it?
Thanks & Best Regards,
Aniket Salunkhe
|
|
|
|
|
Visit this site...
http://www.codeproject.com/menu/
bye...
Giulio
|
|
|
|
|
I have search there. But I didn't found anything regarding Changing font of Menu Item OR Making a Menu Item Bold!
|
|
|
|
|
Hi, I've got some Problems with CPropertySheet in the development of a C++ application in emVC++.
Problem is:
I have a PropertySheet width 4 pages (all same size 260*92); but they all get cut of at the right side.
So I startet do derive a class from CPropertySheet and overwrite the OnInit Method like in this project: Free size and extended styles in CPropertySheets
This brought me a few Problems:
- the CPropertyPage* pppg = GetActivePage(); causes access violation so I changed it into CPropertyPage* pppg = GetPage(0);
(curious from outside, in the dialog class i can use GetActivePage(), inside I only get a 0x0 pointer)
- also the pppg->MapDialogRect(rcOriginal); causes access violation and all other Methods that later on uses pppg too.
This brings me down to the problem that I cannot read out the PropertyPage size on runtime and have to use fixed values to resize.
so only these lines had been left from all the code:
<br />
BOOL bResult = CPropertySheet::OnInitDialog();<br />
<br />
ModifyStyleEx(0, WS_EX_TOOLWINDOW);<br />
CRect rcModified;<br />
<br />
GetTabControl()->GetWindowRect(rcModified);<br />
ScreenToClient(&rcModified);<br />
rcModified.right +=50;<br />
GetTabControl()->SetWindowPos( NULL, 0,0, <br />
rcModified.Width(),<br />
rcModified.Height(), <br />
SWP_NOMOVE | SWP_NOOWNERZORDER | <br />
SWP_NOZORDER | SWP_NOACTIVATE );<br />
<br />
<br />
<br />
GetWindowRect(rcModified);<br />
ScreenToClient(&rcModified);<br />
rcModified.right +=50;<br />
SetWindowPos( NULL, 0,0, <br />
rcModified.Width(),<br />
rcModified.Height(), <br />
SWP_NOMOVE | SWP_NOOWNERZORDER | <br />
SWP_NOZORDER | SWP_NOACTIVATE );<br />
Anyone has an idea why I cannot acces the ActivePage() or also the work with the PropertyPage reference loaded by GetPage(0) causes access violations?
|
|
|
|
|
Hi,
The Create() call of CImageList class takes a parameter for color mask (COLORREF crMask). Is it possible to change this mask after creating it?
Thanks,
AJ
|
|
|
|
|
Hi,
My application is having two threads. One is UI thread doing all UI operations. The another thread is doing some heavy work like writing to disk. How I can achive that only when the system have a light load then only the disk writer thread will run and in heavy load cases it will not schedule or scheduled for very low time?
How can I know that when system is not heavily loaded and when it is heavily loaded?
Is the "Load Balancing" word correct here or it is misleading?
Regards,
Hemant.
|
|
|
|
|
I don't know that you can perform load-balancing as directly as you want to. However, the Windows API offers the 'CreateThread()' and 'SetThreadPriority()' functions, which allow you to create a thread and set its priority. For example, we can create a thread and set its priority to LOW, in which case the operating system will AUTOMATICALLY schedule the thread for execution in such a way that other, higher priority threads will receive more CPU cycles.
This is probably the best way to handle this anyway, as the operating system can allocate CPU cycles more efficiently that you could.
In your example, the disk writer thread would be given a low priority. As other tasks are invoked, such as user interface actions, Windows will automatically suspend the desk writer thread and give priority to the user interface.
Check out the documentation on 'CreateThread()' and 'setThreadPriority()' for a better description.
Scott
|
|
|
|
|
I am having one MFC application ,which is also having one ATL interface.
when I am running this application standalone there is only one instance of application and it is fine.
But if my this EXE is already running and any clients wants to access interface provided by this exe , then there will be two instances of same exe running, I want to avoid it.
What i have done is I have registered this exe with ROT,and when client wants some interface provided by this exe,itcan get it from ROT, but I am facing the problems in getting the appropiate interface from ROT
any help....
RahulB2C
|
|
|
|
|
Dear All,
I need to do that taking files from remote host using CFileDialog.
Can i use CFileDialog for getting file lists from remote host ?
How can i do this ?
Thanks.
Bye.
|
|
|
|
|
Sakthiu wrote: Can i use CFileDialog for getting file lists from remote host ?
The same way you would for a local host. What problem are you having? What does your code look like?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi,
i want to know the total amount of time taken ,when control enters a funtion and leave.Is there any tool to know it.I am using visual studio 2005 professional edition.Is there any third party tool to know it.
Thanks in before
James
|
|
|
|
|
Hi
Use GetTickCount(). This might be helpful for you.
Bye
|
|
|
|
|
|
hi every one
how can i get process parent without using from PROCESSENTRY32 structure?
|
|
|
|
|
ULONG_PTR GetParentProcessId()
{
ULONG_PTR pbi[6];
ULONG ulSize = 0;
LONG (WINAPI *NtQueryInformationProcess)(HANDLE ProcessHandle, ULONG ProcessInformationClass,
PVOID ProcessInformation, ULONG ProcessInformationLength, PULONG ReturnLength);
*(FARPROC *)&NtQueryInformationProcess =
GetProcAddress(LoadLibraryA("NTDLL.DLL"), "NtQueryInformationProcess");
if(NtQueryInformationProcess){
if(NtQueryInformationProcess(GetCurrentProcess(), 0,
&pbi, sizeof(pbi), &ulSize) >= 0 && ulSize == sizeof(pbi))
return pbi[5];
}
return (ULONG_PTR)-1;
}
Napalm
Napalm
|
|
|
|
|
Salam, Good morning everyBody
I want to insert a gridCtrl to my CDialog but I don't find the control in controls menu. can you help me ?
thanks
|
|
|
|
|
Use "Insert ActiveX control" and choose GridCtrl.
OR
Use Chris' Grid Control[^]
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
yes I use this I"nsert ActiveX control" but I only find
- Hirarchical FlexGrid Control
- SSOLEDBGridContrl
-DataGridCtrl (this one is for data from database I don't need it)
thank's for the example,I see it but it's very advanced I want some thing for begginers
|
|
|
|
|
Hi All,
I want to remove menubar from bitmap file then want to display it.
Thanks.
There Is Nothing Right & Wrong
|
|
|
|