Jx_Man 987 Nearly a Senior Poster Featured Poster

this following code to save int file into DAT file :

# include <iostream.h>
# include <fstream.h>

void main ()
{
	int data[] = { 23, 456, 678, 2314, 20, 56, 30981};
	cout<< "Record Data...." <<endl;
	ofstream file_data("INT.DAT", ios::binary);
	for (int i = 0;i < (sizeof(data)/sizeof(int)); i++)
		file_data.write((char *) &data[i], sizeof(int));
	file_data.close();
}
dnk commented: Perfect +1
Sawamura commented: Thanks +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

you mean the form can be change like opacity.If i right then try this following code :
add this following code to module :

Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Long,ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Long,ByVal nIndex As Long,ByVal dwNewLong As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long,ByVal nCmdShow As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long,ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Private Const GWL_EXSTYLE As Long = -20
Private Const WS_EX_LAYERED As Long = &H80000
Private Const LWA_ALPHA As Long = &H2

Public Function Transparant(hwnd As Long, percent As Integer,pil As Boolean)
	Dim before as Long
	before = GetWindowLong(hwnd,GWL_EXSTYLE)
	If pil = true then
		before = before Or WS_EX_LAYERED
		SetWindowLong hwnd, GWL_EXSTYLE, before
		SetLayeredWindowAttributes hwnd, 0, 255 * (percent / 100), LWA_ALPHA
	Else
		before = before And Not WS_EX_LAYERED
		SetWindowLong hwnd, GWL_EXSTYLE, before
	End If
End Function

you can call the function like this :

Transparant Form1.hwnd, val(txtPercent.text), true

you can change text box with other control to get value as percent

Ok. Hope it helps..

Jade_me commented: really complex +1
ITKnight commented: confusing but this a nice code +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

shell function used to apply/run other application and sava the task ID of that application as feedback value. so if none application or failed to call then the feedback value is 0.

this following code is used sintax :
shell(path_Name[,style][,wait][,timeout])
path_name = executable file with the full path of the application which it want to call
Style = a model of application window which it want to call (ex minimize,normal etc).
Wait = a boolean value that prescriptive whether shell function has to wait vb.net finish before working. false is the default value.
TimeOut = a wait time that it needful by shell function to start working if Wait in true value.

Ok.this a little explain. hope it helps..

Jade_me commented: Really Helps to me +1
dnk commented: great explaination +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

try this following code and change the code as you needed :

CrystalReportViewer1.selectionFormula = "Date({DbName.TableName})>= #" & DateTimePicker1.value & " # And Date({DbName.TableName})<= #" & DateTimePicker2.value & "#" 
CrystalReportViewer1.RefreshReport()
Sawamura commented: thx +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

set the background image,FlatStyle,ImageAlign and size on your button properties it will like this..

Jx_Man 987 Nearly a Senior Poster Featured Poster

hi arasten...
sorry for my post before...its code for vb.net but for vb its not different
this is the code :

Shell "shutdown -r -t 00"   ' for restart
Shell "shutdown -s -t 00"  ' for Shutdown
Shell "shutdown -l -t 00"   ' for log off
Shell "shutdown -a -t 00"  ' for abort

but its only work in xp os..
ok. all for the best

Naruse commented: Great Code +1
Jade_me commented: works... +1
ITKnight commented: nice code +1
dnk commented: Good +1
Vega_Knight commented: Worked :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

This code Using 'Shell':

Call Shell("Shutdown /s") 'to shutdown

Call Shell("Shutdwon /r") 'to restart

Call Shell("Shutdown /l") 'to logoff

Call Shell("Shutdown /a") 'to Abort

This Code Using 'Managed Code in .NET':

System.Diagnostics.Process.Start (Shutdown", "/s") 'to shutdown

System.Diagnostics.Process.Start("Shutdown", "/r") 'to restart

System.Diagnostics.Process.Start("Shutdown", "/l") 'to logoff

System.Diagnostics.Process.Start("Shutdown", "/a") 'to abort

Choose the one as u like..
The code in my post its a standard command...
You can add the function with more argument like described below:
to shutdown remote machine, add the argument ' /m MyRemoteMachineName' or
to make process delay, add the argument ' /t nn' with 'nn' is number of second eg: Call Shell("Shutdown /s /m upstaircomputer /t 30") 'it will shutdown the upstair computer in 30 second
if you want to know another argument, type shutdown /? in command prompt window

by - risky k (owner)

Vega_Knight commented: Wonderful:) +1
Naruse commented: Great Code :) +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

hmm...it's the demo/trial version...
you just can convert 100 line of project (if i not wrong).
you must to pay to get the full version..i m sorry.

Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

yup, you cannot get the source code from msi except you add your source code too when you build setup program.

Dukane commented: thank you +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi jade_me..
sawamura already give the function u just add one function again to release capture.
try this following code :

Option Explicit

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "user32" ()

Const WM_NCLBUTTONDOWN = &HA1 'when left mouse button is clicked
Const HTCAPTION = 2 'signed that mouse is working on titlebar.

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Call ReleaseCapture 'tell system through mouse didn't working anymore.
        'tell system through mouse already working on form.
        Call SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
    End If
End Sub

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        Call ReleaseCapture
        Call SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
    End If
End Sub

Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then 'if left mouse button working.
        If Picture2.BorderStyle = 1 Then
            Picture2.BorderStyle = 0
        Else
            Picture2.BorderStyle = 1
        End If
    End If
End Sub

oh yeah, picture1 is titlebar and picture2 is like exit sign.

ok. this all from me, you can change code as u needed.
all for the best

Naruse commented: Helps me much +1
november_pooh commented: viesta +1
Vega_Knight commented: works like charm +1
Estella commented: worked... +1
ITKnight commented: thx +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

hi sawamura,
i reply many code using api function this day.

if u want to snaphot u can use api function (PrintWindow and WindowFromPoint)
this a little sample to you. u can develop as u want..

Private Declare Function PrintWindow Lib "user32" (ByVal hwnd As Long, ByVal hdcBlt As Long, ByVal nFlags As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Type POINTAPI
        x As Long
        y As Long
End Type

Dim lWFP As Long
Dim pt As POINTAPI

Private Sub Command1_Click()
    PrintWindow lWFP, Me.hDC, 0
End Sub

Private Sub Picture1_Click()
    Me.Picture1.AutoSize = True
End Sub

Private Sub Timer1_Timer()
    GetCursorPos pt
    lWFP = WindowFromPoint(pt.x, pt.y)
    Me.Caption = "Handle Window : " & Hex(lWFP)
End Sub

hope this code helps

Jx_Man 987 Nearly a Senior Poster Featured Poster

this api function :

private Declare function flashWindow Lib "user32" (ByVal hwnd as Long, ByVal bInvert as Long) As Long

add this code to timer1 :
FlashWindow Me.hwnd, 1

in this case i set timer interval = 500

hope this helps.
all for the best.

EkoX commented: Great to know this. but i don't know much about api function. +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

i will use shockwave flash.
find this control in component and check this.
it will showing in your toolbox, use like other and add this following code :
i use button here :

private sub command1_Click()
     shockwaveflash1.movie = yourFlashAppPath & "\yourFlashAppName
end sub

Ok.
all for the best

Elladan commented: hmmm ? +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

i used this to load from sqlserver 2000

Private Sub ReadData()
        Dim i As Integer
        Dim cmdUser As New SqlCommand
        Dim daUser As New SqlDataAdapter
        Dim dsUser As New DataSet
        Dim dtUser As New DataTable
        Dim conn As SqlConnection

        conn = GetConnect()
        Try

            cmdUser = conn.CreateCommand
            cmdUser.CommandText = "SELECT * FROM User"
            daUser.SelectCommand = cmdUser
            daUser.Fill(dsUser, "User")
            dtUser = dsUser.Tables("User")
            For i = 0 To dtUser.Rows.Count - 1
                cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
            Next

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Error conection!!")
        End Try
        conn.Close()
    End Sub

call this procedure when form load (form load event)

for note :
cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
this code will adapted with your database, in mydatabase id user in item(0) / first coloumn

ok.
hope this help

Sawamura commented: thanks +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

you can use err object. this object was built in vb.net.
i will give a simple code for u
try this following code :

sub main()
10:       on error goto errHandling
20:       dim a as integer = 2
30:       dim b as integer = 7
40:       dim c as integer
50:       z = x / y
60:       console.writeline("Value of c : " & c)
70:       exit sub
errHandling:
                 dim ErrMsg as string
                 ErrMsg = "Error Number = " & err.number
                 ErrMsg = chr(13)
                 ErrMsg = "Error Description = " & err.Description
                 ErrMsg = chr(13)
                 ErrMsg = "Erorr Line = " & err.erl
                 msgbox(ErrMsg)
                 resume next
end sub

you can use err.clear to clear every err object property
err.source to show object name or application which error provides.

Ok.
all for the best

Naruse commented: not understand :( +1
Sawamura commented: Thx buddy +1
Jade_me commented: Perfectly +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

you can use a function in vb.net to do that (datediff())

dim result as long
        result = DateDiff(DateInterval.Day, dtpicker1.Value, dtpicker2.value)

if you want to get details, you can count month and days by divide the result with days in selected month
in dtpicker

Jx_Man 987 Nearly a Senior Poster Featured Poster

sorted what?