|
It is interesting that you ignore the advice of two respected members with high reputations, but accept it from someone who has hardly contributed anything to these forums.
|
|
|
|
|
No no ..
Even I am thankful to all of you for the reply and solutions.
I will think on evryone's opinion surely.
Thats why i have started working on it also.
But for API key, i need to integrate it in my existsing system thats why i said i am relieved from the tenion thats all.
|
|
|
|
|
Here you go:
https://stackoverflow.com/questions/122607/how-to-consume-a-web-service-from-vb6
The useful life of a "typical" program is 5 years; obviously, you (and I) don't believe in typical.
(I'm not one of the respected ones).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
|
Hello good people. Please I'm using Vb.net 2019 and I have a setup project in the solution explorer which I have packaged and installed on other machines and it works fine.
About some fews weeks later, I realised the setup project was mysteriously unavailable and I tried to repackage using Add new Project. In the add a new Project window, I searched for setup in the template but nothing was found. I came to the main project and clicked on Extensions and found that Microsoft Visual Studio Installer Projects was still installed and ticked. I'm stuck and don't know what to do now. Please I need your urgent help. Thanks
modified 19-Dec-22 3:49am.
|
|
|
|
|
|
Sorry, wanted to type 2019 pls. Thanks for the correction.
|
|
|
|
|
Option Explicit On
Imports Excel = Microsoft.Office.Interop.Excel
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xlApp As Application
Dim xlWorkBook As Excel.WorkBook
Dim xlSheet As Excel.WorkSheet
xlApp = CreateObject("Application Excel")
xlWorkBook = xlApp.xlWorkSheets
xlSheet = xlWorkBook.Sheets("Données principales")
xlSheet.activate
MsgBox("h")
MsgBox(xlSheet.Range("A1").value)
End Sub
End Class
|
|
|
|
|
... and where did you have addressed the workbook itself ?
|
|
|
|
|
And is there supposed to be question there?
|
|
|
|
|
My guess (based on the subject text) is that your question is "Why do I have to put 'Excel =' in the 'Imports Excel = Microsoft.Office.Interop.Excel' line when I could just do 'Imports Microsoft.Office.Interop.Excel'?". If that is your question, the answer is that the 'Excel =' provides a shorter name than having to write the whole lot every time, so rather than having to type
Dim xlWorkBook As Microsoft.Office.Interop.Excel.WorkBook you can simply type
Dim xlWorkBook As Excel.WorkBook . If that is not what your question is, then what is the question?
We at CP are good at answering questions; we are not quite as good at trying to guess what the question is
|
|
|
|
|
There is no (apparent) API for managing icons in the system tray in Windows. Applications that live in the system tray that are aborted through Task Manager, or end without a proper shutdown (error out) will leave their icons in the system tray. Restarting the application then puts another icon in the tray. The zombie icons persist and the only official way to remove them is to float your mouse over them and POOF - they disappear. There simply is no Win32 API for clearing these out. In my research I have found that a lot of folks are looking for the ability to clear these out. I even found one commercial product from a company called APPSVOID But it's bundled in an expensive subscription package.
I suspect the commercial product uses hacks that can be found in various places in languages other than VB. One such can be found at Refresh Notification Area This works, but is written entirely in C++. I'm not a C++ Programmer so I spent some time clumsily refactoring the C++ to vb.net (Framework 4.8 in a Winforms application) and came up with the following and would love it if someone smarter than me could look over my shoulder, laugh a little, and help out:
<pre>Imports System.Runtime.InteropServices
Public Class ClearSystemTray
Private Const WM_MOUSEMOVE As UInteger = &H200
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)>
Private Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As Boolean
End Function
<DllImport("user32.dll", EntryPoint:="FindWindowW")>
Public Shared Function FindWindowW(<MarshalAs(UnmanagedType.LPTStr)> ByVal lpClassName As String, <MarshalAs(UnmanagedType.LPTStr)> ByVal lpWindowName As String) As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)>
Private Shared Function FindWindowEx(ByVal parentHandle As IntPtr, ByVal childAfter As IntPtr, ByVal lclassName As String, ByVal windowTitle As String) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)>
Private Shared Function GetClientRect(ByVal hWnd As System.IntPtr, ByRef lpRECT As Rectangle) As Integer
End Function
Public Shared Async Function ClearTray() As Task(Of Task)
Dim SystemTrayContainerHandle As IntPtr = FindWindowW("Shell_TrayWnd", Nothing)
Dim systemTrayHandle As IntPtr = FindWindowEx(SystemTrayContainerHandle, IntPtr.Zero, "TrayNotifyWnd", Nothing)
Dim sysPagerHandle As IntPtr = FindWindowEx(systemTrayHandle, IntPtr.Zero, "SysPager", Nothing)
Dim NotificationAreaHandle = FindWindowEx(sysPagerHandle, IntPtr.Zero, "ToolbarWindow32", "Notification Area")
If NotificationAreaHandle = IntPtr.Zero Then
NotificationAreaHandle = FindWindowEx(sysPagerHandle, IntPtr.Zero, "ToolbarWindow32", "User Promoted Notification Area")
Dim notifyIconOverflowWindowHandle As IntPtr = FindWindowW("NotifyIconOverflowWindow", Nothing)
Dim overflowNotificationAreaHandle As IntPtr = FindWindowEx(notifyIconOverflowWindowHandle, IntPtr.Zero, "ToolbarWindow32", "Overflow Notification Area")
Await RefreshTrayArea(NotificationAreaHandle)
Await RefreshTrayArea(notifyIconOverflowWindowHandle)
Await RefreshTrayArea(overflowNotificationAreaHandle)
Else
Await RefreshTrayArea(NotificationAreaHandle)
End If
Application.DoEvents()
Return Task.CompletedTask
End Function
Private Shared Async Function RefreshTrayArea(windowHandle As IntPtr) As Task(Of Task)
Dim rect As Rectangle
GetClientRect(windowHandle, rect)
Dim iPos As Integer
Await Task.Run(Sub()
For x As Integer = 0 To rect.Right - 1 Step 5
For y As Integer = 0 To rect.Bottom - 1 Step 5
iPos = (y << 16) + x
PostMessage(windowHandle, WM_MOUSEMOVE, 0, iPos)
Next
Application.DoEvents()
Next
End Sub)
Return Task.CompletedTask
End Function
Since I can barely read the C++ code I have no idea if I did this correctly or not - but... it appears to work.
Here is the original C++ code from the above mentioned site:
<pre>#include "stdafx.h"
#define FW(x,y) FindWindowEx(x, NULL, y, L"")
int _tmain(int argc, _TCHAR* argv[])
{
HWND hNotificationArea;
RECT r;
GetClientRect(
hNotificationArea = FindWindowEx(
FW(FW(FW(NULL, L"Shell_TrayWnd"), L"TrayNotifyWnd"), L"SysPager"),
NULL,
L"ToolbarWindow32",
L"Notification Area"),
&r);
for (LONG x = 0; x < r.right; x += 5)
for (LONG y = 0; y < r.bottom; y += 5)
SendMessage(
hNotificationArea,
WM_MOUSEMOVE,
0,
(y << 16) + x);
GetClientRect(
hNotificationArea = FindWindowEx(
FW(FW(FW(NULL, L"Shell_TrayWnd"), L"TrayNotifyWnd"), L"SysPager"),
NULL,
L"ToolbarWindow32",
L"User Promoted Notification Area"),
&r);
for (LONG x = 0; x < r.right; x += 5)
for (LONG y = 0; y < r.bottom; y += 5)
SendMessage(
hNotificationArea,
WM_MOUSEMOVE,
0,
(y << 16) + x);
GetClientRect(
hNotificationArea = FindWindowEx(
FW(NULL, L"NotifyIconOverflowWindow"),
NULL,
L"ToolbarWindow32",
L"Overflow Notification Area"),
&r);
for (LONG x = 0; x < r.right; x += 5)
for (LONG y = 0; y < r.bottom; y += 5)
SendMessage(
hNotificationArea,
WM_MOUSEMOVE,
0,
(y << 16) + x);
return 0;
}
If someone here is literate in C++ it would be great if you could look this over and see what dumb things I may have done. I am not offended by legitimate criticism (saying you shouldn't be using VB is not legitimate criticism). Also - if someone thinks it's valuable to have this in C# I'm game for that.
modified 29-Nov-22 8:21am.
|
|
|
|
|
The obvious "dumb thing" was linking to the expensive commercial application, which is technically spam.
Also, returning Task(Of Task) is unnecessary; just have the function return Task , and remove the Return Task.CompletedTask lines.
And calling Application.DoEvents is a code-smell. Aside from the fact that it ties your code to WinForms, it will also lead to unexpected behaviour.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks - yes - you are right. I will see if I can edit the link away. If people are interested they can google it themselves!
The Application.DoEvents are not in my final version - I should have removed them before I posted. I often use those to host a breakpoint for convenient place to examine values. Yes - I do occasionally leave them accidentally so I would agree, that remains in the dumb category. However, I do find the occasional DoEvents necessary in some synchronously running tight loops.
I thought an async function should always return a value and some examples from which I learned a long time ago have that task(of task) with the return of task.completedtask. Wow - that is all over my code...
|
|
|
|
|
Dan Desjardins wrote: I thought an async function should always return a value
Perhaps you were confused by the valid "avoid async void" warning - in VB.NET, that would be the equivalent of an Async Sub :
Avoid async void methods | You’ve Been Haacked[^]
An Async Function that returns a non-generic Task is similar to a synchronous Sub that doesn't return anything. An Async Function that returns Task(Of Foo) is similar to a synchronous Function that returns Foo .
In other words:
Sub PrintSync()
...
End Sub
PrintSync() would become:
Async Function PrintAsync() As Task
...
End Function
Await PrintAsync()
And:
Function CalculateSync() As Integer
...
Return 42
End Function
Dim i As Integer = CalculateSync() would become:
Async Function CalculateAsync() As Task(Of Integer)
...
Return 42
End Function
Dim i As Integer = Await CalculateAsync()
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
And now that makes sense to me - especially since your return int is 42
|
|
|
|
|
I want to know some coding for attaching attendance machine's IP Connected or Disconnected. I have a sample image for it.
|
|
|
|
|
Then ask the manufacturer for the sample code.
Even if we knew the make and model of the machine you're using, nobody here is going to do your work for you. All we could do is Google for sample code and give you the links - something you could easily do for yourself.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Ask the manufacturer, they know the capabilities of their device.
|
|
|
|
|
Attendance controls?
That's more expensive than missing a few days from a few of your top devs
To ridicule it more; in the age of working from home? If it is a truck driver, then there's cheaper ideas, they just need to register starting time and end time (yup, done that, been there).
This only a benefit in a supermarket. Are you a supermarket?
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Ping the IP address.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
418
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Currently I am working on an old VB6 app to be compatible with UNICODE.
This app has SSTab and within this tab, there are user control q1, q2, q3 and so on. For q1, it has the following code:
Private WithEvents q1 As VBControlExtender
Private progID As String
procId = "ALCTX10.CTX10.1"
Set q1 = Controls.Add(procId, "q1")
myTab.tab = 1
q1.Move borderSize, topMargin, myTab.Width - borderSize * 2, _
myTab.Height - borderSize - topMargin
q1.Visible = True
The procId is referring to VC++ 6 DLL. All user controls are using this DLL.
For VC++ 6 DLL, I added ",_UNICODE, UNICODE" into the preprocessor definitions under the project setting of VC++ 6.
And compiled the DLL again and then brought it back to VB6.
The problem is I am still getting the same UNICODE issue from VB6 app.
I am using a foreign version of Windows XP so it is not the font problem.
I can’t just replace this DLL with UNICODE supported TextBox or RichTextBox since there are too many things going underneath the DLL.
I would appreciate very much if anyone sheds a light on this problem. Thanks.
|
|
|
|
|
You have atready asked it in VC++/MFC forum.
|
|
|
|
|