English
Forum

Single-Instance Commandline ImageViewer with GDI+

 

Edelpfuscher
moin moin!
it writes and grüßt stefan, 44 years, bits'n'bytes-verwurschtler from hamburg.

need in the job a Imageviewer with the anforderungen: runs under whom most win-versions, fix, tauglich for all gängigen formate, höhe/wide fitting, zoomen, scroll, fokus on aufrufende app give back, standalone, single-instance ... and of course solely as kommandozeilen-tool.
(the went theoretical too everything with Irfan, though is the much To powerful. there's Yes almost none letters, the with it not as - bisweilen fataler - shortcut herhalten must.)

after the half-way inet durchforstet Have and any downloads in vain ausgetestet were, stood solid: selbermachen. somewhere found itself then too into assembled werken The eingestaubte XProfan-cd (Version 8.0) and the grundgerüst was amazing quick together(-geklaut, thank you very much on The gemeinde!), so far - so well.

probs:
- without 'SetAutoPaint 0' was quite nothing with Redraw - with flackert's right tidy
- the story with the einmaligen instance wants simply not correctly. funzen

whom fred 'Doppelstart Instanzen several Programmstarts Verhindern' have I high and down durchgekaut - thanks over again on The specialists! except the ansatz with FindWindow (in the example auskommentiert, because too slow) flew me The speicherverletzungen only so around the ears.

favorisieren would I one behaviour: old instance(en) notice and terminate.

on further tipps, suggestions, examples freue I already,
thanks and horrido!

6 kB
Kurzbeschreibung: XProfanCode (8.0)
Hochgeladen:11/05/12
Downloadcounter176
Download
 
11/05/12  
 



Regards!

there's not really a always working Possibility, a such

Doppelprogrammstart windows-versions-übergreifend 100%ig reliably

To prevent. You can user32::FindWindow using but too hierauf can

You yourself from different Found not 100%ig leave. Perhaps is it

yet relatively sure by TimerProc The regelmäßg (z.B. once per second) by

FindWindow finds and ggf. a terminate-Message sends. Mutexe To

Program Start or Speicherdateien are not "sicherer" there in neueren windows-

versions of Process To Process different Zugriffsrechte not always

present his must. SetAutoPaint 0 draw nothing new, therefore Yes 0.

an Window-APP should the window self new draw if it The Message

moreover get. You could to means with SubClassing works if you not

on the hWnd draw want. i'd with Your example well simply on

the hWnd draw and %hDC2 as well as %HDC likewise describe so

XProfan itself self around the Repaint the %hWnd concern can.
 
11/06/12  
 




Edelpfuscher
thank you very much!

and: pity, pity - The nauseous Messages I had befürchtet. it kursieren Yes diverse 'single instance dlls' - therefore arose The tenuous hope, that it somehow stabiler and allgemeingültiger To make would. (it must Yes Please not same c# his...)

the aufrufende HTA jongliert already with plenty anderem kram around and ought to of such releases the 'instanz-kontrolle' really verschont stay. Timer wären well in each drop too slow, there z.b. a 180°-turn ggf. only The period of time one doppelklicks ausmacht, and thereby evtl. already two aufrufe absetzt.

still: whom zusammenhang with '%hDC2 as well as %HDC' Have I a couple male chasing and still not really understands. must I well again aufgreifen... :o)

horrido!
 
11/06/12  
 




E.T.

...
favorisieren would I one behaviour: old instance(en) notice and terminate
...


i think, there's probably the FindWindow-Variante The best. I resolve the yet always so (for better mutants be I gladly lernfähig), and this has To Win 7 yet too yet no Problems causes.
naturally ought to the Own Progg-Window not straight "Explorer"  or so benannt go...

with this Verfahrensweise is it me too yet never happens, the several Instanzen the Proggs on the werkeln were, because Yes The only ongoing with Neustart the Proggs gekillt  becomes. and who on number sure weg wants, can Yes to the "killen"  einer vorhandenen instance The Search yet 3x repeat
 
XProfan X2
Grüße aus Sachsen... Mario
WinXP, Win7 (64 Bit),Win8(.1),Win10, Win 11, Profan 6 - X4, XPSE, und 'nen schwarzes, blinkendes Dingens, wo ich das alles reinschütte...
11/06/12  
 




Jörg
Sellmeyer
I Have no Solution for the trouble but a Possibility, as Findwindow-Solution faster go could.
instead of the first aufgerufene Program To terminate and the new Image by the second Program Show To let, can the second Program to erfolgtem Check on existence the first, this simply the new Image as Parameter transfer and itself then again yourself terminate. the first Program position then the image in gewünschter Size dar. there must then not again The Programmoberfläche aufgebaut go, during parallel the este Program closed becomes.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
11/06/12  
 




Edelpfuscher
moin and thanks over again.

The Search to present instanzen becomes Yes not thrice repeatedly, separate as often as needed:

While (@FindWindow("iv") > 0)
MyHandle& = @FindWindow("iv")
PostMessage(MyHandle&, $10, 0, 0, 0)
Wend

very the lead to that trouble: between this schleife and the stretch the new, 'findbaren' fensters with cover passing ggf. so plenty time, that the doppelstart even still not sure vermieden go can. the 'findbare' Window füher To settle (and naturally of kill to exclude), results in of/ one augenkrebs-suspect flackerei.

could evtl. a 'kill-message' ($10, $12, etc.) faster his as another?! or lying the flaschenhals, How To suppose would, still with FindWindow self?

the Send the parameter of instance 2 on nr. 1 would sure correctly. knorke, straight too bezügl. the flackerns. but How I get on possible many windoof-versions The parameter whole rübergeschaufelt? gibt's there something 'halbwegs' sicheres?

horrido!
 
11/06/12  
 



How functions this here with you?

Download
CompileMarkSeparation
 {$cleq}
const appTitle="myApp"
const checkVersionMsg=wm_user+1234
//
windowstyle 1 | 2 | 4 | 8 | 16 | 512
windowtitle appTitle
cls
userMessages wm_close,checkVersionMsg
// Adresse nativer Proc beziehen und Opcode abholen
long myNativeTimerProcOpcode=globalAlloc(gPTR,1024)
rtlMoveMemory(myNativeTimerProcOpcode,procAddr(myNativeTimerProc),1024)
//Opcode patchen und Startzeit nativ hinterlegen
long myNativeTimerProcOpcode&,7=getTickCount
// nativen Timer erzeugen ud auf Opcode lenken
~setTimer(0,0,333,myNativeTimerProcOpcode)

do {

    waitinput

    select %uMessage

        caseof wm_close : break

        caseof checkVersionMsg

        case &ulParam<long(myNativeTimerProcOpcode,7) : break

    endSelect

}

end

nProc myNativeTimerProc(long wnd,uMsg,idEvent,dwTime){

    push $FFFFFF
    pop eax
    long myTime=eax
    long chk=findWindowX(appTitle)
    //
    case chk : sendMessage(chk,checkVersionMsg,0,myTime)

}

// https://xprofan.com/intl/de/quelltexte/findwindow-findwindowx-nproc-xprofan/

nProc findWindowX(string s){

    case s=="" : return 0
    long lst=dim(16)
    long lst&,0=0,addr(s),dim(512),len(s)
    enumWindows(procAddr(findWindowX.enumProc),lst)
    long h=long(lst,0)
    dispose(long(lst,8))
    dispose(lst)
    return h

}

nProc findWindowX.enumProc(long wnd,lst){

    PushAll

    if wnd==hWnd {

        popAll
        return true

    }

    long 	r=getWindowTextLength(wnd),\
    l=long(lst,12)

    if r<l {

        PopAll
        return true

    }

    ifnot r==getWindowText(wnd,long(lst,8),511) {

        PopAll
        return true

    }

    if char(long(lst,4),0,l)==char(long(lst,8),0,l) {

        long lst&,0=wnd
        PopAll
        return false

    }

    PopAll
    return 
ss=s4 href='./../../funzione-riferimenti/XProfan/true/'>true }

so the View source with you runs must XProfan with XPSE pimpen: [...]  -

but can Yes first The Exe testing.

with this code remaining The eldest instance receive.

can also slight umgestellt go on: Elder terminate & Neuere receive

On each drop causes this code no Systemlast and operates quasi in the

background passiv and delegates only the Programmbeenden. can Yes time

in the Explorer on the Test.Exe with the Entertaste draufbleiben so beautiful

many Instanzen created go - can zusehen How tappt im dunkeln any again vanish/

reliably worn out and be only The first spare remaining.

1.167 kB
Hochgeladen:11/06/12
Downloadcounter119
Download
 
11/06/12  
 




Edelpfuscher
very calm, thanks!

runs How desired, now must I only yet still whom code durchsteigen...
and is, wie's looks, a whole while last... ;o)

feedback follows...
 
11/06/12  
 



If first fundamentally so working How from you desired then simply yet fix

durchgeben what yet To manage is I the then fix with install would.

in example should the "neuere" Window not at all first attend if already

one present is. the helpful on this code is that the XProfan-Program

self really nothing To do has except To look whether a UserMessage

checkVersionMsg vorliegt and it itself terminate ought to if &ulParam <

long(myNativeTimerProcOpcode,7).
 
11/06/12  
 




Edelpfuscher
The versprochene feedback:

my wissensrückstand bezügl. XPSE and aktuelleren Profanversionen is evident plenty To big, circa in angemessener time to a useful Result To come.

trouble me means in the meantime on another place around the kill überzähliger instanzen and lebe with the krücke (The so far zufriedenstellend and steady runs).

over again thank you very much for tipps and suggestions.
when I moreover come will be, my profanes halbwissen To deepening, remaining unfortunately ungewiss.

horrido!
 
11/15/12  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

6.947 Views

Untitledvor 0 min.
Walter03/31/16
Ernst04/25/14
Peter Max Müller09/20/13
trusel09/01/13
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie