|
Someone at school told me about www.planet-source-code.com, but I dont know if its any good. I havent checked it out yet.
-Raffi
|
|
|
|
|
devx.com
experts-exchange.com
San
|
|
|
|
|
in my program i am reading files, searching for a particular line.. if i find this line i would like to add the line after the line i'm reading..
this whole shebang works well if i use two different files (reading a line, parsing) -> writing this line and the added line if it's the correct one..
if i would like to do this in the same file it doesn't work..
thanks in advance
bernhard
"Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
You can't insert data in the middle of a file, you can either overwrite existing data or append to the end of file. As you have found out, you need two files to "simulate" insertion.
|
|
|
|
|
just to make it sure.. if i want to insert data in the middle of the file i have to make a temp file.. do whatever i want with that file.. and if everyhting is nice i replace the original with the temp file ???
thanks for your answer, a "this helped" for you comes soon
Bernhard
"Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
Yes, basically the method is to copy everything before the insertion point to temp file, write the data to be inserted, and then copy the rest of the original data. If you need to do lots of insertions you should consider using some kind of indexed file structure or a database engine. If that isn't possible, do the insertions in memory and dump only the final data to file.
|
|
|
|
|
I want to display this Dialog at the left corner of the screen when it first display.i add these code to the CMyDialoy::OnInitDialog()
....
MoveWindow(0,0,300,300);
....
but it can't display right.
if i add a button in this dialoy,and add a button handler for it with the above code.when i click this button,the dialog will move the right location.
where is the problem?
|
|
|
|
|
Try this:
CRect rc;
GetWindowRect(&rc);
MoveWindow(0, 0, rc.Width(), rc.Height(), TRUE);
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
it don't work correctly too.the dialog is still displayed at the default coordinate. not the left corner (0,0)
|
|
|
|
|
Hello, the codegurus around the world.;)
MoveWindow works well in my code.
Which line did you put MoveWindows.
MoveWindow should be put before return TURE or FALSE in OnInitDialog.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Any where, but you need to take care, because move window need a HWND, if your window is not created yet, you will get an Assert....
Cheers!!!
Carlos Antollini.
Today is Friday?
No Bob...
|
|
|
|
|
Thanks all.
I have found the reason.
I call the MoveWindow function with parameters (0,0,200,200),
if i change it to (1,1,200,200).it will locate rightly.
if the first and the second parameters are both zero
then this function will only modified the Dialog's Width and Height,don't modified the window's left_top corner coordinate
but how i enforce the dialog move to (0,0) ?
|
|
|
|
|
Try the windows API version of the function. There's nothing (that I saw) on the MSDN CD about this.
Try this and see if it will position correctly:
::MoveWindow(this->GetSafeHwnd(), 0, 0, 200, 200, TRUE);
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
With SetWindowPos....
BOOL SetWindowPos(
HWND hWnd,
HWND hWndInsertAfter,
int X,
int Y,
int cx,
int cy,
UINT uFlags
);
Cheers!!!
Carlos Antollini.
Is Today Friday?
No Bob!!!
|
|
|
|
|
Not when you're in a CWnd class to begin with.
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
CDialog automatically calls CenterWindow() for you after OnInitDialog() returns if the dialog is at coordinates (0,0). You'll need to put it at some other position (like (1,1) or (0,1) or whatever) to avoid CDialog repositioning it for you.
--Mike--
http://home.inreach.com/mdunn/
This posting is provided "as was" with no warranties, guarantees, lotteries, or any of those little bags of peanuts you get on planes. You assume all risk for crossing the street without holding mommy's hand. © 2001 Mike's Classy Software. Member FDIC. If rash develops, discontinue use.
your with and
|
|
|
|
|
VC++6, W2K
Hi,
I am trying to use #import for 2 simliar components.
#import "E:\tools\x\Record.dll" no_namespace
#import "E:\tools\x\AudioFile.dll"
I am getting an error
d:\lab\try2rec\debug\audiofile.tli(59)... overloaded function differs only by return type
can someone please let me know the problem
San
|
|
|
|
|
Probably record.dll and audiofile.dll both define a function with the same name but with different return types. You can avoid this by using namespaces.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thanks Steen,
I tried using namespaces but still I am getting the error
San
|
|
|
|
|
I am in desperate need of some good advice. I am trying to implement a dynamic menu system but the trouble is that I never know how many menu items i will have/need until run-time. Every item runs a standard algorithm (so it needs to be mapped to the same function), which is basically loading a particular file (which is why I don`t know how many items I need til runtime). Do I have to use dynamic message mapping? if so how could I implement it? or is there a function which gives me a handle to the menu? I have tried using WM_MENUSELECT, and this does pretty much what I need except it works as soon as you put the mouse of the item (i.e. you don`t have to even click the item for it to run the algorithm). Is there anyway of getting it to run only after I`ve clicked the item? Sorry, I don`t have any code examples because I`m still scratching my head wondering which direction to take. I would definately appreciate your thoughts on this guys, as it`s really holding me back and is stressing me out beyond belief.
Thanks,
Alan.
AEGC
|
|
|
|
|
If you can assign your menu items consequetive identifiers you can use ON_COMMAND_RANGE.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thanks for the response, I think that is a good idea, but I don`t know what the ON_COMMAND_RANGE would be until run-time, so how would I be able to set it then? Also can you explain how to assign consequtive identifiers to the menu items? I`ve tried using a UINT called count which increments, but rather sadly it failed me.
Thanks again Steen,
Alan.
AEGC
|
|
|
|
|
Well, I haven't actually done this myself so I guess it's on a rather academic level
The MRU in MFC works by using a range of identifiers for the MRU items on the file menu. You could look at the MFC source to get some ideas. But from the top of my head I think MFC reserves 16 identifiers (ID_FILE_MRU1 to ID_FILE_MRU16, not sure about the names). This of course means that there's a max of 16 items on the MRU list. It then maps this range to a function (OnFileMru maybe?). Since the ID of the selected item is passed to the message handler you can surely take it from there.
So what you'll need is a first identifier and a maximum possible last identifier (there's nobody preventing you from setting it to first id + 200, that should kindda cover it, right?), and some assurance that your IDs are not used by other menu items. Those identifiers that are not in use at any particular moment will not be selectable and will thus not generate any WM_COMMANDs, so there's no need to sanity-check the ID that caused the WM_COMMAND in the handler (but I would do it anyway, just out of paranoia
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Can anybody let me have the following files?
iphlpapi.h, iptypes.h,ipexport.h and iphlapi.lib
thank you in advance.
|
|
|
|
|
SORRY, My address is dvisan@forte.ro
|
|
|
|