
OnlyOne Module Crossplattform
- electrochrisso
- Addict
- Posts: 989
- Joined: Mon May 14, 2007 2:13 am
- Location: Darling River
Re: OnlyOne Module Crossplattform
I get invalid memory access error on line 89, the window will not close - 5.21LTS(x86) - Intel Atom N550 

PureBasic! Purely the best 

Re: OnlyOne Module Crossplattform
Update:
History wrote:; Version 1.1
; + IsWindow() in CloseWinCB()
; + Compiler OS Directive for PostEvent in CloseWinCB()
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- electrochrisso
- Addict
- Posts: 989
- Joined: Mon May 14, 2007 2:13 am
- Location: Darling River
Re: OnlyOne Module Crossplattform
Hi ts-soft,
Not sure if the update was a fix to my problem, but I still get a crash when closing the window, perhaps its peculiar to this computer, I will try the code on my other laptops when I get some time.
Not sure if the update was a fix to my problem, but I still get a crash when closing the window, perhaps its peculiar to this computer, I will try the code on my other laptops when I get some time.
PureBasic! Purely the best 

Re: OnlyOne Module Crossplattform
I can't reproduce it and i miss the Info what OS-Version is used, Compiler-Settings ...
Comes the IMA with the example or with other source?
Comes the IMA with the example or with other source?
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: OnlyOne Module Crossplattform
Update:
I hope, this solve the problems by electrochrissoHistory wrote:; Version 1.2
; - Removed the autoclean on #PB_Event_CloseWindow
; + ReleaseOne() to remove Timer and delete LockFile
; + changed Example to reflect the changes
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: OnlyOne Module Crossplattform
What if the application crash or is killed? You won't be able to restart it, right?
Re: OnlyOne Module Crossplattform
No problem on windows. On other OS you can restart after <5 Minutes!Poshu wrote:What if the application crash or is killed? You won't be able to restart it, right?
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- electrochrisso
- Addict
- Posts: 989
- Joined: Mon May 14, 2007 2:13 am
- Location: Darling River
Re: OnlyOne Module Crossplattform
Yes that update fixes the problem tsts-soft wrote:Update:I hope, this solve the problems by electrochrissoHistory wrote:; Version 1.2
; - Removed the autoclean on #PB_Event_CloseWindow
; + ReleaseOne() to remove Timer and delete LockFile
; + changed Example to reflect the changes

Being new to modules, I am not sure what situations to use the code.

PureBasic! Purely the best 

Re: OnlyOne Module Crossplattform
Example: You have written a tabbed texteditor. You have registered the extension (Mime-Type) *.txt with your program.electrochrisso wrote:Being new to modules, I am not sure what situations to use the code.
With my module, you make sure your program runs only once. If the user open a textfile, you get the message with
the file to open in a new tab. No new instance of your program is started.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

- electrochrisso
- Addict
- Posts: 989
- Joined: Mon May 14, 2007 2:13 am
- Location: Darling River
Re: OnlyOne Module Crossplattform
Ok, now I see, this code will come in handy for certain types of applications, thanks for sharing.ts-soft wrote:Example: You have written a tabbed texteditor. You have registered the extension (Mime-Type) *.txt with your program.electrochrisso wrote:Being new to modules, I am not sure what situations to use the code.
With my module, you make sure your program runs only once. If the user open a textfile, you get the message with
the file to open in a new tab. No new instance of your program is started.

PureBasic! Purely the best 

Re: OnlyOne Module Crossplattform
An interesting take - I've always used a temporary port number instead of mutexes or files.
Of course in Windows that means you have to allow access to the network, so your code does win here as there is no "oh noes, the application is wanting to do something! It might be naughty!" of the UAC.
On the flipside, there is no file created, so if the application crashes, you can just just up and running again on the Linux and Mac systems.
I have to rethink my windows approach and use yours - cheers!
Code: Select all
InitNetwork()
If CreateNetworkServer(#PB_Any, 65000) = 0 ;<-- choose a port number in the range of 50000 - 65000 for an unused temporary port
End
EndIf
MessageRequester("Yoohoo!", "I'm here!")
On the flipside, there is no file created, so if the application crashes, you can just just up and running again on the Linux and Mac systems.
I have to rethink my windows approach and use yours - cheers!
Re: OnlyOne Module Crossplattform
I have found an annoyance. With Win7, the params, if files, are passed with the 8.3 shorthand...unfortunately, this means if you update the TitleBar with the filename, it is displayed in the truncated format.
Does anybody know how to expand it to the full filename?
thanks...
Does anybody know how to expand it to the full filename?
thanks...
Re: OnlyOne Module Crossplattform
You should always use #DQUOTE and not shortnames!
http://www.purebasic.fr/english/viewtop ... 24#p342324
http://www.purebasic.fr/english/viewtop ... 24#p342324
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: OnlyOne Module Crossplattform
Don't know where you suggest I use the DQ's--I wrapped the param filewrite with them, but that did not help. Then, I implemented your GetLongFromShort() and now it is working.ts-soft wrote:You should always use #DQUOTE and not shortnames!
http://www.purebasic.fr/english/viewtop ... 24#p342324
Thanks for the suggestion!
Re: OnlyOne Module Crossplattform
On many windows-machines shortpathnames no more available. the creation is deactivated for performance reason on:
most server, most pcs using ssd, ...
Use
and not the shortnames.
most server, most pcs using ssd, ...
Use
Code: Select all
param.s = #DQUOTE$ + "c:\Program Files\bla.txt" + #DQUOTE$
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
