English
Forum

Question of the Week!

 
- Page 1 -



Frank
Abbing
Perhaps is so one Thread time nice. Someone asks a programming task and the rest trying to find a short and good solution...
The best solution would be put to the code snippets.

My task for today is:

Find a short and fast Solution to determine, if a directory is empty or not!
 
08/25/08  
 



 
- Page 2 -



Sebastian
Sprenger
Jörg Sellmeyer
why do you even through the Lg(10) dividest. The is still 1 or?

True, he is it?
*ausprobier*
Yes, he's. well to know. One can take the logarithm to a certain base (in my case 10) calculate, but if The Lg-function with 10 anyhow 1 outputs, kann's Yes omitted.
 
Profan² 7.0e, XProfan 9, 11.2a, FreeProfan32
Windows Vista Home Premium 32-Bit, 2.8 Ghz, 4 GB RAM
Windows Me, 1.8 Ghz, 256 MB RAM
08/29/08  
 



 
- Page 3 -



Jörg
Sellmeyer
Lg is the common logarithm. Correctly, the length a number:
Len% = Lg(Zahl&) + 1

Because it potentates the (so the power number) determined the power of the 10 is, to get the number:
10^0 = 1
10^0.nnnnn = Value betw. 1 and 9.9period
10^1 = 10
10^1.nnnnn = Value betw. 10.nnnn and 99.9period
10^2 = 100
10^2.nnnnn = Value betw. 100.nnnn and 999.9period
10^3 = 1000
10^3.nnnnn = Value betw. 1000.nnnn and 9999.9period
...
Set("Decimals",15)
Print 10^3.64777486' = ~4444
print "4444 hat",Int(Lg(4444)) + 1,"Stellen"
WaitInput
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
08/29/08  
 




Frank
Abbing
Nice try...
 
09/04/08  
 



 
09/04/08  
 




Frank
Abbing
Please only Tasks, To them You yourself too a Solution know...
 
09/04/08  
 



Hey, You should still not insist that this not given is!
 
09/04/08  
 



So unfortunately I do not Solution to the bottom of the following task. Prehistory: Years ago, a voice recognition program called G-Vox, had instead of a Windows control to a round green thing with more or less versteckten Erhebungen, The at Mausklicken gelber get, itself verformten and at (zeitgefächerten) release each defined Options controlled (means kurzer, medium length and long click what effect different).

The thing could also apply to the Desktop-background as a rubber disc are rumgeschubst and was from the screen edges billardmässig reflects. All other Desktop-items were functionally (!), and in a certain mode, the important thing from even the mouse, if it was hidden, which one would click below. Intended design protection or something on it, but:
The principle itself, namely how something not-rechteckiges over the Desktop functioning may move, would my interests.

Nostalgic background: i'd like my 3D-Papierflieger of snow anno over the Destop fly... Code of dunnemal attached.
Greeting, woodpecker

4 kB
Hochgeladen:09/09/08
Downloadcounter253
Download
 
09/09/08  
 




Jörg
Sellmeyer
there gibt's what Thomas Hölzer, what one could adapt:
 $H windows.ph
 $I profalt.inc
' PRFellow - Presentation
' shows, how to simulate a round window
' Author: Thomas Hölzer
' needs Profan 6.0 (32)
Def CreateEllipticRgn(4) !"GDI32","CreateEllipticRgn"
Def DeleteObject(1) !"GDI32","DeleteObject"
Def InvertRgn(2) !"GDI32","InvertRgn"
Def PaintRgn(2) !"GDI32","PaintRgn"
Def SetWindowRgn(3) !"USER32","SetWindowRgn"
Def Capture Release(0) !"USER32","ReleaseCapture"

Proc DrawTime

    Declare t$
    Rectangle 120,140-190,160
    Let t$=time$(0);":";Left$(time$(1),2)
    DrawText 120,140,t$

ENDPROC

'##################################

Proc Put

    SetWindowPos %hwnd = (Rnd(%maxx -300) + 300),(Rnd(%maxy -300) + 300) - 300,300

ENDPROC

'###################################
Declare end%,rgn&,x%,move%
SetTrueColor 1
Window Style $78
Window Title "Rundes Fenster"
Window 0,0-300,300
User Messages 16
Let rgn&=CreateEllipticRgn(0,0,300,300)
SetWindowRgn(%hwnd,rgn&,1)
Cls RGB(0,0,255)
UseFont "Arial",20,0,0,0,0
UseBrush 1,RGB(0,0,255)
USEP 5,0,0
Text Color RGB(255,255,255),-1
DrawText 80,80,"Rechte Mouse button!"
DrawTime
SetTimer 1000
'#########################################
Var Timer& = ~SetTimer(%hwnd,1,1000,ProcAddr(Put,0))
'#########################################

WhileNot end%

    WaitInput
    Case %umessage = 16:Break

    If %wmtimer

        DrawTime

        If move%

            SetWindowPos %hwnd=x%,0-300,300
            Add x%,10
            Case Gt(x%,%maxX):Let x%=0

        EndIf

    EndIf

    If Equ(%message,$204)

        CreateMenu
        AppendMenu 1, "&Invertieren"

        IF move%

            AppendMenu 2,"&Anhalten"

        Else

            AppendMenu 2, "B&ewegen"

        EndIf

        AppendMenu 3,"&Farbe ändern"
        Separator
        AppendMenu 4,"&Beenden"
        TrackMenu %MouseX,%MouseY

        If MenuItem(1)

            InvertRgn(%hdc,rgn&)

        Elseif Menuitem(2)

            Let move%=hardship(move%)

        ElseIf MenuItem(3)

            Randomize
            ' with Region-function:
            ' UseBrush 1,RGB(Rnd(256),Rnd(256),Rnd(256))
            ' PaintRgn(%hdc,rgn&)
            ' The course also tuts...
            Cls RGB(Rnd(256),Rnd(256),Rnd(256))
            DrawTime

        ElseIf MenuItem(4)

            Let end%=1

        Endif

    Elseif Equ(%message,$201)

        UseCursor 5
        Sendmessage(%hwnd,$0112,$0F012,0);
        UseCursor 0
        Capture Release()

    EndIf

Wend

KillTimer
'#####################
~KillTimer(%hwnd,Timer&)
'#####################
SetWindowRgn(%hwnd,0,0)
DeleteObject(rgn&)
End

Nice airplane!
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
09/09/08  
 



Did you Winform  [...]  ?
 
09/09/08  
 



Must first learn times, what do the ~-Dinger...
Please where can I get profalt.inc ? (Search in the Profan-directory and here unfortunately negative...)

1. appendix: This sounds with round windows ever quite well ...
2. appendix: WOW, is Windows itself can already? Dammit, I will still API-friend...
3. appendix: Hey, I've created a Triangular window! --> Schneekönig!!!
thanks!
 
09/09/08  
 




Jörg
Sellmeyer
and CombineRgn can one still different forms join.
The Profalt.inc You do not need, since the functions in XProfan10 Add, Sub u.s.w. still function. ex 11 Operators are only permitted.

The ~-pair (called incidentally Tilde) lead a substitute terms, external from a file (here Window.ph) the actual values/Funktionsnamen o.ä. be read.
~KillTimer(...) is then for External("User32","KillTimer",....)
Look under Header-Files to.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
09/10/08  
 



Hi,
I had too a small task for you,
is one little schwerer, and of course there's under windows 7 so a function where one einstellt in whom mode the computer straight runs (is in the Systemtray). there's there whom Energiesparmodus and the Hochleistungmodus.
my question moreover sounds can with XProfan one Program write what autommatisch into Moden changes, d.h. if z.B. The CPU-Use niedriger as 50 is changes it into Energiesparmodus and as they higher is into Höchsleistungsmoodus oderr so. best would naturally if the program in background walk would or only Systemtray To see would? Well vlt falls you Yes ne Solution one or, it would Real very useful if it automatically into Moden weckseln would!!!!

mfg

Julian57
 
10/15/10  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

25.168 Views

Untitledvor 0 min.
p.specht05/22/13
mene12/06/12
Peter Max Müller12/11/11
Jens Tiburski12/29/10
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