|
thanks for your suggestions, still i have some things to clarify.
I have just 256 addresses so i will go with rewriting the file. But to do this i need to save the rest of the file temporarily, what do you think the data structure i have to use to do this.
Thanks again.
|
|
|
|
|
Hello,
First, I assume that you are using MFC's CStdioFile class since I don't know of a CStdio class.
You can do the following:
CList<CString> StringList;
CString sLine = "";
while( YourFileObject.ReadString(sLine) )
{
StringList.AddTail(sLine);
}
while( !StringList.IsEmpty() )
{
YourFileObject.WriteString(StringList.RemoveHead());
}
Hope this helps
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
One idea would be to use a slightly different format for your file...like an .ini file.
[Addresses]<br />
Address1=Description1<br />
Address2=Description2<br />
Address3=Description3
You could then use GetPrivateProfileString and WritePrivateProfileString to read/change the values.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
<kmedcalf@ev1.net>
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Hi
I have simple windows DLL.
In my DLL i have a function named as "MyFunc" which contains three parameters from which two are "in" parameter and the third one "out" parameter. I am sure I m getting the value in my third parameter. But when I try to call it using Visual Basic programm, I am not getting the value ? What seems the problem....
I am writing whole code for your reference here..
VC++ DLL Function code :
========================
void __stdcall MyFunc(char *sMyString, long lType, char **sResult)
{
char sTemp[255] = "Mahesh";
*sResult = new char[512];
strcpy(*sResult,"");
strcat(*sResult,sTemp);
........
........
........
strcat(*sResult, "; ");
return;
}
VB Programm Code to test....
===========================
Dim sReference As String
Private Declare Sub MyFunc Lib "C:\....\MyDLL.dll" (ByVal sMyString As String, ByVal PrdID As Long, ByRef sOut As Variant)
Private Sub Command1_Click()
Dim sPrefix As String
Dim sResult As String
sPrefix = "CST"
sReference = Space(27)
Call AiGetLicense(sPrefix, 3, sOut)
MsgBox (sOut)
End Sub
==============================================
Here I get sOut as balnk
But when I debug my DLL i get value in *sResult as "Mahesh;"
What seeems to be the problem ?
Any idea plz ?
Thankx a lot
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Amarelia wrote:
void __stdcall MyFunc(char *sMyString, long lType, char **sResult)
Amarelia wrote:
Private Declare Sub MyFunc Lib "C:\....\MyDLL.dll" (ByVal sMyString As String, ByVal PrdID As Long, ByRef sOut As Variant)
shouldnt the 3rd param be of varient type in VC++?
or sOut of type string?
-prakash
|
|
|
|
|
hallo...
can someone help me on this give me an full example of source code...?????
or used a link listed queue?????/
Nadz
|
|
|
|
|
Won't STL's priority_queue do for you?
There's a nice sample in MSDN of it too.
Hope this helps
--
Roger
|
|
|
|
|
I agree, no point on working hours to build a less powerful, untested version of something that is part of the compiler / language.
John
-- modified at 8:15 Wednesday 12th October, 2005
|
|
|
|
|
John M. Drescher wrote:
no point...
I can think of one very important point. If a person wants to truly understand how a particular data structure works, you must create one from scratch. Using a built-in one does not accomplish this goal.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hello all,
can anyone tell me how I can add new build configuration??
In new project are two conf. Debug and Release.
I would like add Debug Unicode, Release Unicode ....
But there in no choise to do this ....
please help me
Thanx xSoptik
|
|
|
|
|
What about the menu Build/Configurations/Add ?
(That's what it looks like in VC++ 6.0 anyway).
|
|
|
|
|
Thanx
In VC7 there is a little different situation.
That choose is hidden in popup menu.
|
|
|
|
|
when i compile a program, an error occur,as below:
"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlconv.h(996) : error C2084: fucntion“LPDEVMODEA AtlDevModeW2A(LPDEVMODEA,const DEVMODEW *)”already Has a
body......."
is there anybody know how to solve this?
MS Visual Studio .net 2003
Windows Xp Professional SP2
Additional: Everything is ok under Windows2000
hello everybody!
|
|
|
|
|
Hi.
In visual c++ i want to create one class in order show algorithm sort by graphic.
Example sort: 1 4 6 5 8
I want to exchange 6 and 5 by graphic.
class CricleObject{
//attribute
int x, y, r;
int value;
//method
CricleObject();//constructor
CricleObject();
void moveLeft();
void moveRight();
};
In algorithm code:
//CricleObject array[10];
if (array[1].Value > array[2].Value){
array[1].moveRight();
array[2].moveLeft();
}
...
They are show by graphic.
Thanks.
-- modified at 22:11 Tuesday 11th October, 2005
|
|
|
|
|
you need to create few bitmaps probably, and use timers and gdi functions to move the images around.
Good luck.
-prakash
|
|
|
|
|
The following code is to enumerating the USB drives, But how can I get the corresponding drives label as it enumerating?
hDevInfo = SetupDiGetClassDevs((LPGUID)&GUID_CLASS_USB_DEVICE,
0, 0, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if (hDevInfo == INVALID_HANDLE_VALUE)
return false;
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
for (i = 0 ; SetupDiEnumDeviceInfo(hDevInfo, i, &DeviceInfoData) ; i++)
{
DWORD DataT;
LPTSTR buffer = new char[1024];
DWORD buffersize = 1024;
while (!SetupDiGetDeviceRegistryProperty(hDevInfo, &DeviceInfoData,
SPDRP_HARDWAREID, &DataT, (PBYTE)buffer, buffersize, &buffersize))
{
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
if (buffer)
LocalFree(buffer);
buffer = (char*)LocalAlloc(LPTR,buffersize);
}
else
break;
}
...
|
|
|
|
|
If/when you find the drive letter for it, use this code:
char buffer[MAX_PATH];
char driveNameBuf[MAX_PATH];
// Make sure the drive name ends with a backslash, else GetVolumeInformation() won't find it.
strcpy(driveNameBuf, "C");
if(driveNameBuf[strlen(driveNameBuf) - 1] != '\\') strcat(driveNameBuf, "\\");
// Or, simpler, use just "D:\\";
SHFILEINFO sh;
DWORD dw = SHGetFileInfo(
driveNameBuf, // LPCTSTR pszPath,
0, // DWORD dwFileAttributes,
&sh, // SHFILEINFO FAR *psfi,
sizeof(sh), // UINT cbFileInfo,
SHGFI_DISPLAYNAME // UINT uFlags
);
if(dw) strcpy(buffer, sh.szDisplayName); // Ok, create a good looking text line
else strcpy(buffer, driveLetterBuf); // Not Ok, create a less good looking text line
|
|
|
|
|
I mean how do I get the USB drive letter through
hDevInfo
or
&DeviceInfoData
|
|
|
|
|
I have a progress bar in my dialog with id IDC_WP_PROGRESS.
I have done the following. But still the progress bar is not working. The execution is not calling WM_TIMER at all. What am I missing????
BOOL CALLBACK DialogProc (HWND hDialog, UINT message, WPARAM wParam,
LPARAM lParam)
{
int nPos = 1;
HWND hProg;
hProg = GetDlgItem(hDialog,IDC_WP_PROGRESS);
switch (message)
{
case INIT_DIALOG:
......
case WM_TIMER:
{
if (wParam == IDC_WP_PROGRESS)
{
nPos = nPos+1 ;
SendMessage(hProg,PBM_SETPOS,(WPARAM)nPos,0);
}
break;
}
case WM_USER_MSG:
{
SendMessage(hProg,PBM_SETRANGE,0,MAKELPARAM(0,50));
SendMessage(hProg,PBM_SETPOS,(WPARAM)nPos,0);
int ret = SetTimer(hDialog,IDC_WP_PROGRESS,150,NULL) ;
if(ret == 0)
MessageBox(0, "Could not SetTimer()!", "Error", MB_OK );
......
}
..........
|
|
|
|
|
Are you absolutely sure the WM_TIMER is not posted?
It looks to me that since your nPos is a local variable, which is reset to 1 each time the function is called, you will never see a progress bar setting more than 2.
I would add an OutputDebugString for the WM_TIMER and make sure it is NOT getting called, since everything here looks okay, assuming you don't send WM_USER_MSG too often, which would constantly reset your progress bar and your timer.
|
|
|
|
|
Thanks for ur reply.
Ya I tried with OutputDebugString. It's not calling the WM_TIMER at all.
I made the nPos global. But still could'nt get it work.
Is it because of USER msg?? I see 2 bars every time ( but npos is not local)
I think that its because of the PBM_SETPOS I do before calling the SetTimer().
I tried calling the SetTimer code in INIT (just to check). In that case the WM_TIMER get posted only once. I see 4 bars in the progress bar.
|
|
|
|
|
I found out why...
My WM_USER takes long time to complete. So in that time I thought of displaying the progress bar. But the WM_TIMER is not getting posted until the WM_USER is finished. I was killing the timer at the end of WM_USER. so it seemed like the progress bar is not working. When I commented the kill timer code I see the progress bar getting started after the WM_USER is completed ( which I dont want).
Too bad to use WM_TIMER.
Any way...Thanks for your help.
|
|
|
|
|
It seems like your WM_USER or whatever message processing should be doing work from a separate thread, then your UI can be updating with a progress bar.
|
|
|
|
|
Ann66 wrote:
The execution is not calling WM_TIMER at all.
What does the call to SetTimer() look like? Where is it called from?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Search for all KillTimer calls. Something could be killing it.
No see-you, no heal-you. Ptthh.;P - Der Dokter
|
|
|
|