Hi

First I should ask if it is possible to create a project from an existing folder with an existing asm file.

I have made an exe that creates a rap file. Now I was about to convert it to an addin. The problem is the dialog not showing up. I have succeeded to create a memuitem and to get an AIM_COMMAND to the DllProc. But the
invoke DialogBoxParam,hInstance,IDD_DLG1,hWin,addr DlgProc,0
always returns -1. I can't understand what's wrong though I have done exactly as the colref addin I made a while ago (later improved by Eviloid).

Any suggestions.

Regards
Posted on 2003-03-28 08:21:59 by minor28
Use GetLastError to get the error number, it will tell you a bit more about why it's not displaying. It could be that you are using a Common Control that is not initialized.
Posted on 2003-03-28 08:40:34 by donkey
Hi minor28

Other possibilities:

- hInstance is wrong
- Resource not linked into dll

KetilO
Posted on 2003-03-28 08:43:15 by KetilO

First I should ask if it is possible to create a project from an existing folder with an existing asm file.


That is possible but you have to create a project and copy the files into the new folder. Rename the files to the same as the folder name and use the new RAP file and add the necessary files to your project. You must also copy the stringtable and Resource sections from the RAP file to the new one.

I think this would be a very useful addin project though I have other things to work on. It would be easy enough to do, just create a folder copy/rename the files and modify the appropriate sections of the RAP file :


Type=
Description=


the whole section in case you are transferring from EXE to DLL or Visa-versa


rename all of the paths, relative paths should be OK


rename all of the paths, relative paths should be OK

If nobody is interested in doing this I might give it a shot after I get a little further on my current project.
Posted on 2003-03-28 09:45:51 by donkey
Hi

I found it. First I checked hInstance and linking resource. They were OK. Then I used GetLastError to get the error number. Error number 1814: The specified resource name cannot be found in the image file. In the resource file I found "#define IDD_DLG1 1000" and "IDD_DIALOG1 DIALOGEX 6,6,194,131".

Thanks both of you
Posted on 2003-03-28 14:16:39 by minor28
Hi again,

Now I have an addin which creates a project file. I would like to do some improvments. For example open the new project. How do I send message to RadAsm to open the project in the same way as dblclick on the rap file in the project three. This didn't work.
mov eax,[lpPStruct]

mov (ADDINPROCS ptr [eax]).lpOpenProject,TRUE
invoke SendMessage,hWnd,AIM_PROJECTOPENED,0,0


Regards
Posted on 2003-03-31 08:05:25 by minor28
lpOpenProject is a proc, it is called, not data moved to it. ie:
push FALSE ; use the open project dialog

mov eax,[lpPStruct]
call (ADDINPROCS ptr [eax]).lpOpenProject
If you wish to open an existing file I believe you pass a pointer to the proc containing the name of the project file ie:
lea eax,ProjectFileBuffer

push eax
mov eax,[lpPStruct]
call (ADDINPROCS ptr [eax]).lpOpenProject
Posted on 2003-03-31 10:18:44 by donkey
Hi donkey / minor28

First case is correct.

Second case:

mov eax,
mov edx,(ADDINDATA ptr ).lpFile
invoke lstrcpy,edx,addr szYourProjectFile
push TRUE
mov eax,
call (ADDINPROCS ptr ).lpOpenProject

KetilO
Posted on 2003-03-31 11:37:01 by KetilO
Hi

KetilO. Before I read your reply I tryed donkey's code. I worked. The project started in the same way as dblclicking the rap file in the project window.

In file popupmenu I have added a menuitem "Create Project File". This menu activate a dialog with 4 radiobuttons for masm, fasm and so on. I only use masm so the others are disabled. It should not be difficult if someone wants to add the other assemblers.

The dialog also hav 2 radiobuttons for EXE and DLL projects.

I noticed that the foldername don't have to be the same as the project file names.

Once you have created the project file and started the project you can add more files and make changes through the ordinary project options dialog.

This addin serves my purpose. I suppose it could be improved. Anyone who feels called upon to do that is wellcome.

Regard
Posted on 2003-03-31 14:11:47 by minor28
Hi Minor28,

It probably only worked because the RAP file happened to be in the lpFile buffer at the time it was called. You should use the method KetilO showed to guarantee that the right file is in the buffer.

Donkey
Posted on 2003-03-31 14:22:17 by donkey
Ok

I have changed. I also noticed that I didn't link the resource in the releas version.

Regards
Posted on 2003-03-31 15:08:09 by minor28
Hi minor28

The idea here is very good. :alright:

Unfortunatly it is still buggy and a bit difficult to understand how to use it.

KetilO
Posted on 2003-04-02 14:11:30 by KetilO
Hi

In due time I will try to make it general as an addin for RadAsm and the assemblers.

Regards
Posted on 2003-04-02 23:44:16 by minor28
Hi KetilO and donkey

I think this would be a very useful addin project though I have other things to work on. It would be easy enough to do, just create a folder copy/rename the files and modify the appropriate sections of the RAP file :


Well, for me it was not easy enough to do. I can't imagin how KetilO keep his, what I belief, enormous amount of RadAsm code in order. This addin is just on the limit of my capacity. But I think I am improving every time I visit the board.

This addin was created because I often start with a simple code to test something and it usualy ends up with the need of a project. Up to now you had to use the "New Project" menuitem, which means that if you have a file opened and want it in a new project workspace, you have to close the file, create a new folder and new empty files with the project dialog. Then you had to copy the files into the new folder. Rename the files to the same as the folder name and use the new RAP file.

With this addin you can create a new project file with the opened file in the existing folder.
The project workspace is then automatic opened. After opening you can add files and dialogs to the
project as usual.

Clicking on a menuitem in make popupmenu first seaches the folder for a *.rap file. If found you vill be asked if you want to open the project workspace. If no *.rap file is found you will be asked if you want to create a project workspace. These actions can be disabled with the option = 2 in the radasm.ini file.

I hope you will find it useful. It is tested on a win98 and a win2k machine. Feel free to improve the code and I would appreciate to get as much feed back as possible.

Installation:
1. Copy CreateProject.dll to \RadASM\addins

2. Add text below:
x=CreateProject.dll,y

to section named: in file RadASM.ini
*x is next free number

y=0 :Create Project file is disabled.
y=1 :All facilities accessible.
y=2 :Disable the make facility.

Regards
Posted on 2003-04-08 10:24:33 by minor28
Hi minor28

Seem stable now. Very nice. :alright:

KetilO
Posted on 2003-04-09 04:04:01 by KetilO
A messagebox about adding files turned up where it shouldn't.

Regards
Posted on 2003-04-11 00:54:13 by minor28
found it. First I checked hInstance and linking resource. They were OK. Then I used GetLastError to get the error number. Error number 1814: The specified resource name cannot be found in the image file. In the resource file I found "#define IDD_DLG1 1000" and "IDD_DIALOG1 DIALOGEX 6,6,194,131".


but you didn't tell what you have done to fix it ;)
sometimes i get the same effect, it is really irritating.
KetilO, can't ya do someting to fix this buggy resource problem?
Posted on 2004-01-02 07:07:03 by wizzra
Hi wizzra

Sorry for the late answer. My internet connection has been down since before Christmas Eve. However I have now revised the CreateProject addin.

The addin creates a new menuitem "Create Project" in File menupopup.

If you have a titled file loaded in the editor and there is no
rap-file in the folder the menuitem is enabled.

"Create Project" opens a dialog window with options like the project
wizard. The OK button creates a project file and the project workspace
is loaded. Now you have a project.

On the other hand, if you have a titled file loaded in the editor and
there is a rap-file in the folder but the project is not opened,
the menuitem is disabled. If you try to use any of the menuitems in
Make menupopup you can enable a messegebox asking if you want to load
the project before making. This option also asks if you want to create
a project if there is no rap file in the folder. Yes opens the Project
Dialog window and the project is created and loaded befor making.

There are three options:
1) Enable the CreateProject (default on)
2) Enable request for opening a present project or createin
a project befor making (default off)
3) Enable an ifo messagebox after a project is created telling
you the possibility to add any files to the project (default off)

Best regards

edit: download next attatchment
Posted on 2004-01-10 05:47:18 by minor28
unfortunately I must admit two bugs that appeared after I have adjusted and commented the code

1) The project description got wrong text. (line 66 in new Dlg.asm)

2) In project wizard if you choose "Win32App(no res) and unchecked the "Compile RC" checkbox the ",3" in the linkin option was deleted. (line 126 in new Dlg.asm)

A new releas is attatched.

Regards

EDIT: New releas here
Posted on 2004-01-10 06:47:43 by minor28