|
If you go to line 701 of MY.CPP, you'll see a new statement. Whenever the owner of the CArray object goes away, you'll need a corresponding delete statement.
|
|
|
|
|
I inserted in the registry (HKCR/myappdata/shell/open) the command line to open a file ("c:/programs dir/my app dir/myapp.exe" "%1") from the shell.
Ok, it works, but the working dir is always "c:". I would like to tell Windows that when opening a file from the shell the working dir is "c:/programs dir/my app dir".
A solution could be to write in the code
SetCurrentDir(GetExeDirectory()), but doing so it would be impossible to use another working dir...
Any suggestion?
thanks
|
|
|
|
|
In your app, in the initial Update, get the command line, parse for the .exe (or use the command line parser from CP, make a search about it), get the next string after the exe, here you have the path to your file.
put a SetCurrentDir(str_commandline_file);
You'ra done.
~RaGE();
|
|
|
|
|
I don't need the file path, I want that the working path is the same of the exe.
But I can't encode that in the source code, I must say that to she shell...
|
|
|
|
|
You caught me wrong.
Assume the user, when installing your tool, put it in F:\Apps\Mytool\Tool.exe, and registers your associated files with extension .paolo.
Then, he opens an explorer, doubleclicks on myfile.paolo which is in C:\CurrentFiles.
So your command line, sent from the shell to the code, is :
F:\Apps\Mytool\Tool.exe C:\CurrentFiles\myfile.paolo
So now you can retrieve the exe path, and use SetDirectory()
~RaGE();
|
|
|
|
|
That could be a good solution, but I can't get the full command line...
The variable m_lpCmdLine only contains
"C:\CurrentFiles\myfile.paolo"
without "F:\Apps\Mytool\Tool.exe"
|
|
|
|
|
In InitInstance() :
CString str=GetCommandLine();
In fact, m_lpCmdLine contains only the parameters. Check this in the MSDN for more info, i give you just the remark here :
Remarks:
ANSI console processes written in C can use the argc and argv arguments of the main function to access the command-line arguments. ANSI GUI applications can use the lpCmdLine parameter of the WinMain function to access the command-line string, excluding the program name. The reason that main and WinMain cannot return Unicode strings is that argc, argv, and lpCmdLine use the LPSTR data type for parameters, not the LPTSTR data type. The GetCommandLine function can be used to access Unicode strings, because it uses the LPTSTR data type.
~RaGE();
|
|
|
|
|
Thank you!!!
It was so obvious, that I couldn't find it
|
|
|
|
|
What you want cannot be done. When you associate a file-type with a program, you provide an absolute path to the EXE responsible for it. How else do you think Windows is going to know how to find it? You could, however, get away with just putting the name of the EXE in the registry, and then making sure the EXE can be found via the PATH environment variable. Sloppy, but do-able.
|
|
|
|
|
Hi everybody,
How can I delete a specific record from an array in the Visual C++ environment?
I have an array of object pointers. I want to enter a book title for example from the keyboard and then to have an option of deleting it, from the array. Is this possible?
Regards,
grscot
|
|
|
|
|
First you would need to delete the block of memory that the array element is pointing to. Then you would need to delete the array element itself by moving all elements after the one to be deleted to the left. Let me see if a picture will help:
-----------------<br />
|0|1|2|3|4|5|6|7|<br />
-----------------
If you wanted to remove element #4, elements 5, 6, and 7 would be moved to the left one time, like:
-----------------<br />
|0|1|2|3|5|6|7| |<br />
-----------------
Now you have an empty spot where element #7 used to be. You can either free it up, or leave it so that when another element is added, the memory is already allocated.
|
|
|
|
|
You have to iterate through the array and check the value if it is the same as what the user entered and then assign it NULL.
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Or you can use the MFC CArray wich is a template, that takes care of everything.
#include "Afxtempl.h"
CArray<myobj*,myobj&> arObj;
arObj[n].RemoveAt(index);//it will remove the element and shift to the left
there are plenty of method to do everything you need.
cheers!
Daniel Cespedes Daza
"Santa Cruz de la Sierra Paraiso Terrenal!"
daniel.cespedes@ieee.org
|
|
|
|
|
Cambalindo wrote:
CArray arObj;
This is the correct way of declaring the array
CArray<myObj*,myObj&> arObj;
Daniel Cespedes Daza
"Santa Cruz de la Sierra Paraiso Terrenal!"
daniel.cespedes@ieee.org
|
|
|
|
|
Hi, everyone!
I want to use VC++ to send an Email to someone.
And my application is a console application. (command
line based.) I have searched this site and find all
the sample codes are written in ATL or COM. Well ... I know
nothing about these topic. I simply want to know
where can I find some simple samples which is written
in plain VC++ and a seperate E-Mail sending class?
Thanks in advance,
George
|
|
|
|
|
Look for "CMapi" class it should exist in the codeproject,... if not.. www.google.com
http://www.codeproject.com/internet/cmapi.asp
the latest release....
http://www.naughter.com/cmapi.html
|
|
|
|
|
Thanks, imsniper buddy!
George
|
|
|
|
|
Hi
i have a report style list control within a dialog
the dialog is called from the Main frame, which is a list view
when i click on ok my dialog i want to update the list view
in the main frame with whats in my list view in my dialog
any ideas
ta
si
|
|
|
|
|
Override the CModal method of your CDialog and put a pointer to your listview as a parameter (CDialog::DoModal(stuff, CListView *pListView))
put a CListView *m_pListView; member variable in the CDialog class.
In the DoModal, make m_pListView=pListView;
member parameter of DoModal
This will give you a pointer on your CListView within the CDialog.
Override the CDialog::OnOK() method, and do your update BEFORE the call to CDialog::OnOK(); made in this function (otherwise you'll get your app to crash, since the memeber variables would have already been destroyed.)
You're done.
~RaGE();
|
|
|
|
|
I'm currently developing a program for displaying movie contents on a screen. This means that i could have to change the contents of the graphics up to 60 times per second. Which functions are best suited for this?
Thanks in advance.
-Rune SVendsen
|
|
|
|
|
Can't you use the media player or an active-x control ? is your movie file a custom one or usual avi, mpeg ... ?
~RaGE();
|
|
|
|
|
It's an MPEG2 file, but i'm decoding the file myself.
|
|
|
|
|
Hi,
I am trying to locate the function address (user defined function)once I load the image of my executable. I have gone through the article by Matt Pietrek about the PE file format but still i am unable to work out how one can locate the address of a function in the mapped memory after calling MapAndLoad API or subsequent calls to CreateFileMapping and MapViewOfFile.
Can anyone help in this regard. Has anyone tried to locate the function address this way?
Regards,
Nitin.
|
|
|
|
|
Why not just do a LoadLibraryEx, passing LOAD_LIBRARY_AS_
DATAFILE or DONT_RESOLVE_DLL_REFERENCE flags to prevent it from initializing. Then, you can use the usual GetProcAddress() to look up the address of the function.
|
|
|
|
|
how to restrict a user from accessing contents of the local drives by typing them in the internet explorer address bar..
like if i type c: in internet explorer it opens up the c drive i want to restrict this type of access.
is there any way that i can know what is typed in the url bar and do what i want before navigating.
thanks in advance
qrious
|
|
|
|