|
I am curently using windows98. I have open regedit and did a search for .syx and did not find anything with %1 in it. I am afraid you may be going over my head. i.e. i'm lost.
|
|
|
|
|
hlmechanic wrote: I am curently using windows98.
Which matters not.
hlmechanic wrote: I have open regedit and did a search for .syx
It should be near the top of the HKEY_CLASSES_ROOT hive with all of the other file extension types.
For example, if you look for .txt, you'll see it has a default value of txtfile. Looking further down the list for txtfile, you should find:
HKEY_CLASSES_ROOT\txtfile\shell\open\command
Does the same sort of thing not exist for your .syx extension?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
under HKEY_CLASSES_ROOT/.syx It says (default) "syx_auto_file"
under HKEY_CLASSES_ROOT/syx_auto_file it says (default) SYX File
SYX File does not show up anywhere else
|
|
|
|
|
hlmechanic wrote: under HKEY_CLASSES_ROOT/syx_auto_file it says (default) SYX File
You should have a shell key under that. In all, it should look like:
HKEY_CLASSES_ROOT\syx_auto_file\shell\open\command
If not, why not make the necessary changes to see if that helps.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I must have missed the + befor the folder icon becouse there is HKEY_CLASSES_ROOT\syx_auto_file\shell\open\command and it's value is ""H:\Copy of folder\prog.exe"%1"
My apoligies for missing this the first time.
|
|
|
|
|
This is just a guess, but those double quotes look ill-placed. It's hard to tell which are actually part of the registry's value and which you added as part of the post. I would have thought it to look something like:
"H:\Copy of folder\prog.exe" "%1"
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I got it to look like you said. now when I double click a .syx file I get _argc=4 with _argv[3] as H:\copyof~2\file.syx
I could use _argv[_argc-1] to get this value but I still get unexpected results from just double clicking the aplication icon in explorer window.
p.s. what does the %1 do?
|
|
|
|
|
hlmechanic wrote: now when I double click a .syx file I get _argc=4...
Which it should be 2.
hlmechanic wrote: with _argv[3] as H:\copyof~2\file.syx
What is the value of _argv[0] , _argv[1] , and _argv[2] ?
hlmechanic wrote: p.s. what does the %1 do?
Nothing per se. It gets replaced by the file that was double-clicked.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I am no longer at the same computer. now I am at a computer running windows XP. It gives me _argc=5. _argv[0] is still what is expected. The rest seem to be "H:\Copy of folder\prog.exe H:\Copy of folder\file.syx" with each _argv[] after 0 being a part of the line between spaces (except the space between the two file names). Windows seems to be trying to break the line up into arguments as a dos line would be. I was wishing there was a way to get this information that did not involve _argv[] or some way to make it give me the whole line so that I could break it up as I wanted.
Also I wanted to thank you for your help.
|
|
|
|
|
You still have not indicated whether this is a console or GUI application. That makes a ton of difference in how command-line arguments and drag/drop operations are handled.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have found GetCommandLine() wich seems to be promising. When H:\copy of folder\file.syx is draged and droped onto H:\copy of folder\prog.exe then GetCommndLine() returns "H:\copy of folder\prog.exe" ":\copy of folder\file.syx" (including quote marks). If the same thing is done in H:\folder then "H:\copy of folder\prog.exe" H:\copy of folder\file.syx is given (note change in quote marks). I think I can get the filename from this.
I found this from the questions and answers at the end of the folowing article
Managing argc and argv[] with STL in a simple way
specal thanks to DavidCrow for trying to educate me.
|
|
|
|
|
If this is a GUI application, are you handling the WM_DROPFILES message?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
This is a GUI. Written in Borland C++ 4.52
I handled WM_DROPFILES with the folowing code.
void DrumWindow::EvDropFiles(TDropInfo dropInfo){
int NumFiles;
char NextFile [MAX_PATH];
NumFiles = dropInfo.DragQueryFile (-1, NULL, 0 );// Get the # of files being dropped.;
for (int File = 0; File < NumFiles; File++ ){
if ( dropInfo.DragQueryFile (File,NextFile,MAX_PATH ) > 0 ){// Get the next filename from the HDROP info.
/////work with file name NextFile here if valid (removed to keep short)
};//end if next exist
};//end for each file
dropInfo.DragFinish ();// Free up memory.
};//end EvDropfiles
|
|
|
|
|
I'm confused. Why are you using GetCommandLine() when DragQueryFile() is how "dropped" files are retrieved?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
my wish is to find out wich file was used to start the program by dragging the icon of the file onto the unopened program icon. I would also like to be able to set the file extenshion to open the file using this program so the user can double click on a file with the right extenshion and start the program with that file loaded into it. I do not know how to make DragQueryFile() tell me wich file was used to start the program.
The Drag and Drop onto the open program window works great but I have not noticed that it sends any information about a file that was draged onto the unopened program icon in windows explorer, or about wich program was double clicked to start this program. I suspect that this is because DragAcceptFiles is not called untill 'SetupWindow()'
IF there is a better place to put DragAcceptFiles that would let the program find out this information it would be much easyer to do.
|
|
|
|
|
I have used the following tutorials to get a window on the screen.
http://www.zeuscmd.com/tutorials/win32/05-CreatingWindows.php
This is fine as the person writing it give pretty good explainations of what he does.
I have been unable to fine out how to put a button onto this screen as i cannot find and decent guides for this. Microsofts documentation is quite horrid, poorly orgainized and spits huge reams of code at you with little in the way of commenting.
Look at the java documentation for how it should be done tbh.
Now that mini rant is over this is my code that i copied from MSDN for putting a button on the screen.
<br />
hwndButton = CreateWindow( <br />
"BUTTON",
"Do Something",
WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
<br />
10,
10,
130,
20,
hwnd,
NULL,
(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), <br />
NULL);
It does just that and its is one of the better commented examples and i have put two buttons on the screen.
What i cannot work out is how to identify the buttons when the message handles method is called.
this is coded as follows:
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch(msg)<br />
{<br />
case WM_CLOSE :<br />
DestroyWindow(hwnd);<br />
break;<br />
<br />
case WM_DESTROY :<br />
PostQuitMessage(0);<br />
break;<br />
case WM_KEYDOWN:<br />
if(wParam == 'U'){<br />
MessageBox(NULL, "U Pressed", "U", MB_OK);<br />
}<br />
break;<br />
case WM_KEYUP:<br />
if(wParam == 'L'){<br />
MessageBox(NULL, "L Released", "L", MB_OK);<br />
}<br />
<br />
case BN_CLICKED:<br />
if(true)
MessageBox(NULL, "left ", "L", MB_OK);<br />
else<br />
MessageBox(NULL, "right ", "L", MB_OK);<br />
}<br />
return DefWindowProc(hwnd, msg, wParam, lParam);<br />
}
Anyone have any ideas? or any links to decent guides to win32 programming? (which don't just tell you have to get visual studio to generate the code for you)
|
|
|
|
|
gunner_uk2000 wrote: if(true) //have no idea what to put in here to work out which button was press.
if (hwndButton == hwnd)
...
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
That does not work, as it returns false when the hwndButton was clicked.
It also generate a compiler warning.
I i understand correctly hwndButton is a handle to the button, and hwnd is a handle to the window, so i don't see how checking if they are equal (which they will not be) will determin which button was pressed.
Correct me if i'm wrong.
|
|
|
|
|
gunner_uk2000 wrote: I i understand correctly hwndButton is a handle to the button, and hwnd is a handle to the window...
A button is a window.
The ninth argument to CreateWindow() is supposed to be the ID associated with the button control. You're using NULL . When a control generates a message, it is sent to the parent window. Processed messages are typically not sent to DefWindowProc() .
You should have:
hwndButton = CreateWindow(..., (HWND) MY_BUTTON, ...);
...
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_COMMAND:
if (LOWORD(wParam) == MY_BUTTON)
MessageBox();
return 0;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
When you create the button, set the hMenu parameter of CreateWindow to some resource ID such as IDC_MYBUTTON1. Define a value for this constant in your resource.h header file or some other place you want. Then in WndProc, switch the low-word of wParam which sends you the ID of the message source as
case WM_COMMAN:<br />
switch(LOWORD(wParam))<br />
{<br />
case IDC_MYBUTTON1:<br />
<br />
case IDC_MYBUTTON2:<br />
Enjoy...!
|
|
|
|
|
hi
I am programming for windows ce, and I need to know how to change a file type association using c++, what functions should I call to change the program that opens a specific file type (eg: .mp3)???
Thanks alot
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Hi guys
I have been trying to make an app that gets the arra input from the user for ex:
I have made a variable for an edit box and named it BYTE m_bytes then i make another edit box and add the variable BYTE m_arrayinput thne i make a function like this:
void whatever()<br />
{<br />
UpdateData(true);<br />
<br />
BYTE myarray[m_bytes] = {m_arrayinput};<br />
}
now what i want to do with this code is to for example the user enters:
Bytes: 2<br />
<br />
Array Input: 0x60, 0x90
then i want the function to interpret it as:
void whatever()<br />
{<br />
UpdateData(true);<br />
<br />
BYTE myarray[2] = {0x60, 0x90};<br />
}
but this code does not work and i havnt got a clue of how to make it work so could someone please help me?
Thanks in advance
Cyclone
|
|
|
|
|
Cyclone02 wrote: BYTE myarray[2] = {0x60, 0x90};
This won't work that way. The CEdit data is a string, so you will have to parse that string and assign it to each element in the array.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Cyclone02 wrote: I have made a variable for an edit box and named it BYTE m_bytes...
You should be using a CEdit member variable for an edit control.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
for both of the variables? or just the bytes one?
|
|
|
|