| Check for enabled NIC and execute command |
|
 |
Index ‹ Visual Studio ‹ VB Scripts
|
- Previous
- 1
- Visual Basic [VB] >> TUTORIALS ON COMPUTER PROGRAMMINGlanguages Have the complete details regarding programming languages.
A-Z about programming languages like Java J2EE, C++, code
implementation guides and more.
http://operatingsys.blogspot.com/
Google.com is not only a search engine but also does webadvertising
through websites and blogs.
Lakhs of common people are earning hundreds of dollars through online
advertising.
It also has other products like chatting,google earth,google talk etc.
Genuine Internet jobs for all. Earn Unlimited income.visit
http://googlepromisesyou.blogspot.com/
- 2
- MFC >> VC2008 dpiaware manifest?When you create a new MFC application with the wizard in VC2008 you will see
the following code in stdafx.h:
#pragma comment(linker,"/manifestdependency:\"type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
What do you write in stdafx.h to add the dpiaware manifest (se below) the
same way?
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings
xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
Best regards from Gaute
- 3
- VB Scripts >> force clicking on an objectHello,
How can I force clicking on an object,
if I have the following code, and I want to do click on event_view -
How can I do that ?
Thanks :)
The code :
-------------
<input type="hidden" id="event_view" onclick = "myview" />
...
- 4
- 5
- Visual Studio C++ >> How to convert _TCHAR * to string?I need to check command line parameter
if (argv[1] == option) .... // option is a string variable
And argv is defined as _TCHAR* argv[] by MSVS wizard.
The code don't work and it's very hard to convert argv[1] to string.
- 6
- MFC >> ActiveX in MFCI'm trying to create an ActiveX control in MFC.
I have a library which was provided for the development of an MFC program
NOT ActiveX.
I made a sample ActiveX and included the library under
Project->Settings->Link Tab but after building the ActiveX and viewing the
control in Test Container, no methods were exposed??
Am I doing something wrong or will the library NOT work with an ActiveX???
Thanks
David
- 7
- Visual Studio C++ >> Simple question about dllimportI've got a h file for a usb device that has definitions of function exported
from a dll. An example would be (with #defines translated):
extern "C" __declspec(dllimport) int __stdcall FT_Open(int deviceNumber, int
*pHandle);
but where is the actual dll filename specified so my program knows where to
find it?
Thanks,
Michael
- 8
- MFC >> How to implement transparent static on dialog box?I would implement a transparent static text to show
the status text of the progress on dialog box.
The background of dialog box is not default system color.
Originally, I set the bk mode of the static to transparent mode
and return a NULL_BRUSH in OnCtlColor() of dialog class.
It can fit my requirement if the static text is not changed.
However, the old text is not erased if the static text is changed.
I think I need to override some function to erase background first.
Which function do I need to override to erase the background?
or I need to implement my own static class to do so? and how?
Best Regards
Jackal Huang
- 9
- Visual Basic >> "Reading emails from All Public folders"Hi,
I am developing a vb application to read the latest arrived mail from
"All public folders" through outlook. This should be dynamic as the
folders increase in the "All Public folders", The program should read
the folders accordingly.
Can anyone help on this.
- 10
- Visual Basic >> compiling the entire thingHi guys...
Here's a quick query...
I have almost finished making my first project in vb...
But I am confused...as to how should i compile the entire project and make a
setup ...
i know how to make the exe files...
I searched through MSDN but couldn't get much info...
And does the setup do everything ?...I mean what about the DSNs I created in
Control Panel, and what about my entire database ?...is that also properly
installed with the setup ?...
And how do i start doing it ?....
Please help...
thanks..
anupam
anupam@anupamjain.com
- 11
- Visual Basic >> Calling a Macro from another workbookHi,
Yes I have read up on the different ways of doing this, but I always
come to the same problem.
In my current code I have the line
Application.Run ("T1Seed1.xls!Main")
Which works fine (it calls the "Main" macro in T1Seed2.xls). But once
the "main" macro is run, the rest of my current macro doesn't run.
Here is my code (missing some variables thata bit above, but thats
ok).
Dim ESDUFile, RootPath, WorkBookToOpen, SheetToOpen, BuildingHeight As
String
ESDUFile = Sheets("Rotate spf red").Cells(10, 9)
RootPath = ESDUFile
Do While Right(RootPath, 1) <> "\"
RootPath = Left(RootPath, Len(RootPath) - 1)
Loop
BuildingHeight = 225
SeedScale = 345
For A = 1 To NumTowers
For B = 1 To 2
SheetToOpen = "T" & A & "Seed" & B & ".xls"
WorkBookToOpen = RootPath & SheetToOpen
FileCopy ESDUFile, WorkBookToOpen
Range("C22:C57").Copy
Workbooks.Open WorkBookToOpen
Windows(SheetToOpen).Activate
Sheets("RWDI_Factors").Select
Range("H67").Select
ActiveSheet.Paste
Range("D7") = SeedScale
Range("D6") = BuildingHeight
Application.Run ("T1Seed1.xls!Main")
Sheets("Factors").Select
Application.CutCopyMode = False 'closes the clipboard with massive
amounts of data thus does not prompt to save or close
ActiveWorkbook.Close True ' false means not to save, true means to
save and close
Windows("MR_Setup_underDevelopment_profiles.xls").Activate
Next B
Next A
It works fine up until right after the Application.Run line where it
will not continue on (ie it will not select the "Factors" sheet or do
anything after).
Is there another way I can do this that will allow the original macro
to continue running after it calls the macro in the other workbook?
Any help would be appreciated.
Jack
- 12
- Visual Studio C++ >> Problem with covariant return typesThe following code won't compile (error C2555: 'B::f': overriding virtual
function return type differs and is not covariant from 'A::f') unless I
moved the definitions of X and Y to before the definitions of A and B
respectively. Now I can understand that the compiler doesn't know that Y is
derived from X when parsing B but at the very least this is a very confusing
error message and I'm not sure it shouldn't be accepted.
Rob.
class X;
class A
{
public:
virtual X* f () const = 0;
};
class X
{
public:
};
class Y;
class B : public A
{
public:
virtual Y* f () const;
};
class Y : public X
{
public:
};
- 13
- 14
- Visual Basic >> Icon size problemHello,
My program's frmAbout has an icon. The ico file has the same icon in two
sizes, 16 x 16 and 32 x 32 pixels. I don't want the smaller one to be
displayed to users. So, the size should be 32 x 32 pixels.
Anyway, on some computers the icon will be displayed in size 16 x 16
pixels. How could I prevent this?
The ico file is dislayed in picIcon which is a PictureBox element. Its
ScaleMode is "Pixel", AutoDraw is "False", and AutoSize is "False".
The ScaleMode value of frmAbout is "Twip".
What should I do?
Thanks,
Mika
- 15
- Visual Basic >> ErrorsDear All,
Does anyone know of a third party tool that can add error handling code to
all subs/functions in a class or module to a specified format which then can
be customised to deal with the errors likely to be raised at the code?
I have been neglectful in adding error handling code and comments as I go as
the project has now grown and other developers are going to be using my
code. I know that it is bad practice and I have learned my lesson, but any
advice, other than its your own fault, would be most welcome. If I have to
create my own add-in for the future, can anyone suggest how I can
programatically find the start and end of a sub to add the suggested code?
Thanks again.
Alastair MacFarlane
|
| Author |
Message |
tbonanni

|
VB Scripts >> Check for enabled NIC and execute command
Hello all. I am trying to write a script with minimal vbs knowledge. I have
downloaded scriptomatic 2.0 and have made some progress but have come to a
head.
Background:
We use WSUS for all local and remote users in an NT4 domain (soon to be
migrated to AD). Remote users connect via Cisco VPN client. The clients
installs as a network device, is disable when not in use and enables when
the GUI is loaded. The detection frequency setting for WSUS runs at
intervals of 8 - 20 hours according to the documentation. This causes the
remote client to almost never check for updates.
Solution:
Write a script which checks or better still listens if the VPN is active
(objItem.ServiceName(CVirtA) and when it becomes active
(objItem.NetConnectionStatus=2) then run the command (wuauclt /detectnow).
I have the beginnings of something pasted in below which obviously doesnt
quite work unless you comment a few lines here and there, but doing that
does not give the desired result.
Can I use wsh/vbs to monitor the connection or would this need to work on a
timer?
If a timer how would that affect memory consumption on the notebook?
TIA.
' start script
On Error Resume
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("localhost")
For Each strComputer in arrComputers
WScript.Echo
WScript.Echo "======================"
WScript.Echo "Computer: "& strComputer
WScript.Echo "======================"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_NetworkAdapter", "WQL", _
wbemFlagReturnImmediately
+ wbemFlagForwardOnly)
If objItem.ServiceName="CVirtA" And objItem.NetConnectionStatus="2" Then
' C:\Windows\SYSTEM32\wuauclt.exe /detectnow
End If
Visual Studio153
|
| |
|
| |
 |
| |
 |
Index ‹ Visual Studio ‹ VB Scripts |
- Next
- 1
- Visual Basic [VB] >> Console.Writeline hangs if user click into the console windowI have a console app which does it's job and frequently spits out status
messages with Console.Writeline. I noticed that, if the user
accidentally clicks into the black console window, the cursor changes to
a filled white rectangle, and the app hangs at the next Console.Write
statement.
Can that be solved somehow? It is very dangerous for the application to
stop just because of a wrong mouse click.
I know I could reimplement the app as a windows forms app and write the
status messages to a ListView - but it is more of a fundamental
question. Since if this cannot be solved, I'd never write another
console app again for production environments.
Thanks for any help
Urs
- 2
- Visual Basic >> The best way to yield processor to other users for long-running prOur VB application gets data from SQL Server database and send the data to
the client using socket.
The data returned to the client can be around 800,000 records, and this can
take a while. I know, what do you use 800,000 records for ?
Other application is using those data to draw a chart.
While the application is processing requests for 1 user (say to return
800,000 records), other users can not interact with the application, until it
finishes
sending all 800,000 records to the clients.
I am thinking to put a DoEvents in the loop after the application sends a
certain number of messages to the client, so that
other users will be able interact with the application if the 1st user is
requesting a lot of data.
I am wondering if there is a better way to do it.
In VB Help it says for long-running processes, yielding the processor is
better accomplished by using a Timer or delegating the task to an ActiveX EXE
component.
In the latter case, the task can continue completely independent of your
application, and the operating system takes case of multitasking and time
slicing.
When I moved the processing codes to an ActiveX exe, the application still
does the same thing where it waits until it finishes processing the ActiveX
EXE
before other users can interact with it.
How can I do it correctly with either the ActiveX exe or a Timer ?
These are my original codes:
sub CIServer1_PacketReceived (ByVal FromClient As Object, Packet As Variant,
ByVal BytesRec As Integer)
:
Do While Not rs.EOF
sStr2 = "|" & rs("PACKET_DATA")
If Len(sStr2) + Len(sStr) < c_MAXOUT Then
sStr = sStr & sStr2
Else
sStr = Mid(sStr, 2) & "|"
FromClient.Send sStr 'send data to client
y = y + 1
'I am thinking to do the following codes to do DoEvents after sending a
certain number of messages to the client
If y > c_MAX_TO_SEND Then
y = 0
DoEvents
End If
sStr = sStr2
End If
rs.MoveNext
Loop
sub CIServer1_PacketReceived (ByVal FromClient As Object, Packet As Variant,
ByVal BytesRec As Integer)
:
Set obj = New myActiveXExe.mycls
'GetSendData does the same thing like the above "do while not" without the
DoEvents.
'But, the application still waits until it finishes processing the ActiveX
before
'other users can interact with it.
obj.GetSendData FromClient, sSql
Thanks a lot.
- 3
- 4
- Visual Basic >> output to text file copied data from Clipboard...Hi, I'm a bit new to this... but here it goes.
I have created a macro on which in one part it does a copy of a
certain selected text. I wan't this copied strings, which I belive is
now on the clipboard, pasted on a text file.... or essantially I wan't
to know how can I output this copied data to a text file? any ideas...
thanks in advance!
-Jona
- 5
- VB Scripts >> Bold characters in a message boxHi there
This is a newbie question.
How can i put some characters in bold in a message box? I tried with \b
but couldn't succeed.
And how to insert a CRLF in a message box?
Thanks for your help
Phil
- 6
- MFC >> DeleteTimerQueueEx, why it never returns?Hi,
I've got a thread, where i create TimerQueue. Everything goes perfect,
untill i don't want to close the Queue. If i do it that way:
DeleteTimerQueueEx( m_hTimerOutQueue, INVALID_HANDLE_VALUE );
it never returns. But if i Close it like that:
DeleteTimerQueueEx( m_hTimerOutQueue, NULL);
it obviously returns, but i can't start it again. Could You, please tell me,
what can couse that?
I'm just the beginner with MultiThreading and Timers, so i don't even know,
what could help You in finding out the solution.
Ask me whatever You want:]
Thx GIGI
- 7
- Visual Studio C++ >> LNK 4210 comes when i migrate from VC6.0 to VC8.0Hi,
I had a DLL build using VC 6.0. I migrated the Source to VC8.0. Now I
am getting the linker error "LNK4210: .CRT section exists; there may be
unhandled static initializers or terminators".
Please note that I have my own DLL Entry point specified in the make
file for the DLL.
I have checked documentation. I have tried to call _CRT_INIT function
in my entry point funtion but then i get the LNK2001 unresolved
external symbol CRT_INIT.
Can anybody tell me the exact problem and fix for it.
As far as I can figure out the constructors for global members is
called by run time library. but in this case i am not able to
initialize the run time library (_CRT_INIT ??)
Thanks
Programmer_2004
- 8
- MFC >> CRichEdit Control -Vertical Allignment(Visio Type)Hai,
Iam looking to insert text in RichEdit Control so that it is
centered/left/right vertically and by default VC++,CRichEdit supports
Horizantal allilgnment and i would like to do similar to Visio if we drag a
box and enter the text and we have both options(Horizantal/Vertical) to set
the text in the box and any expert comments would be helpful
Thanks and Regards
suresh
- 9
- MFC >> Internal error.. any help?Can anybody please help me in fixing this link error that i get in my
VC++ project?
Linking...
LINK : error : Internal error during ReadSymbolTable
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 0040ED6B
NumberParameters = 00000002
ExceptionInformation[ 0] = 00000001
ExceptionInformation[ 1] = 00000000
CONTEXT:
Eax = 40070F98 Esp = 0012EAC4
Ebx = 3FFF0000 Ebp = 004695A8
Ecx = C0000A40 Esi = 40070F5C
Edx = 00000000 Edi = 3FFF01C0
Eip = 0040ED6B EFlags = 00010202
SegCs = 0000001B SegDs = 00000023
SegSs = 00000023 SegEs = 00000023
SegFs = 00000038 SegGs = 00000000
Dr0 = 0012EAC4 Dr3 = 3FFF0000
Dr1 = 004695A8 Dr6 = C0000A40
Dr2 = 00000000 Dr7 = 00000000
Error executing link.exe.
Tool execution canceled by user.
I get this error when i try to build a VC++ project that uses a static
library was made using another VC++ project.
Thanks
- 10
- MFC >> Looking for information on MFC TCP CommunicationWe have roughly 6 software programs that run in tandum with each other
that currnetly use UDP to transmit information (Images, various little
packets, etc) between each program. I'm developing a new application
that is pumping more data through and we've decided to give TCP a shot.
I'm personally new to Network communication and TCP, I know the basics,
but nothing in-depth. I'm looking to develop a generic stand-alone
class with input and output queues that will act as an interface for
each program. I think this will be the best way to go, but welcome any
other suggestions from those with more experience.
Can someone point me to a location where I can get an intro to socket
communication with MFC?
The sending / receiving will be done in seperate threads as queue data
arrives. I've read that CAsyncSocket has issues with threading. Does
anyone know if this is still the case?
Thanks in advance for the help,
Josh McFarlane
- 11
- MFC >> VC++6, DAO, Access, create tableI'm trying to create a table using the Execute method of
CDaoDatabase. However, when trying these statements I get
the corresponding errors shown below
TRIED:
CREATE TABLE Kund (Kundnr NUMBER PRIMARY KEY NOT NULL,
Namn TEXT(40) NOT NULL, Ort TEXT(30))
ERROR MESSAGE:
Syntax error in CREATE TABLE statement.
TRIED:
CREATE TABLE Kund (Kundnr NUMBER PRIMARY KEY NOT NULL,
Namn TEXT NOT NULL, Ort TEXT)
ERROR MESSAGE:
Syntax error in CREATE TABLE statement.
That error message is not very helpful. Is there a way to
see more exactly what the error is? Or if you don't know
that, maybe you know what is wrong with my Access SQL
query?
/Joachim
- 12
- MFC >> RoundRect and borderHello,
I'm using RoundRect method to draw a rectangle.
How do I draw a RoundBorder(using different color) around this
RoundRectangle ?
Thanks,
Janiv Ratson.
- 13
- 14
- VB Scripts >> Help with Right functionnnanna wrote:
> *SAMPLE FILE IS:*
>
> 13301794560@133SH.COM
> 13301794560@133SH.COM
> 2205171@MCIMAIL.COM
> 35988869625@SMS.MTEL.NET
>
> *DESIRED RESULT:
>
> 133sh.com
> MCIMAIL.COM
> sms.mtel.net
>
> When I use the [B]Right* function to get the strings right of "@" it
> doesn't give me the desired result, the *Left* function does
> give strings right of "@". Any ideas?
>
> CODE
>
> '##############################################################################################
> '##############################################
>
> 'Textfile to read
> sInpFile = "C:\WindowsScripts\vbscript\ExcelList\ListItems.txt"
>
> 'Result file
> sResultFile = "C:\WindowsScripts\vbscript\ExcelList\clean.txt"
>
> 'Character to search
> strInput = "@"
>
> ' FileSystemObject.CreateTextFile
> Const OverwriteIfExist = -1
> Const FailIfExist = 0
>
> ' FileSystemObject.OpenTextFile
>
> Const FailIfNotExist = 0
> Const ForReading = 1
> Const ForAppending = 8
>
>
>
> Set oFSO = CreateObject("Scripting.FileSystemObject")
>
> ' Get list item names into an array:
> Set f = oFSO.OpenTextFile (sInpFile,ForReading, FailIfNotExist,
> OpenAsASCII)
>
>
>
>
> Dim aListitem()
> i = 0
> Do Until f.AtEndOfStream
> sLine = Trim(f.ReadLine)
> If Not sLine = "" Then
> ReDim Preserve aListitem(i)
> aListitem(i) = sLine
> i = i + 1
> End If
> Loop
> f.Close
>
> ' Loop through the listitem array
>
>
> ' Create result file
> Set fOutputFile = oFSO.CreateTextFile(sResultFile,OverwriteIfExist,
> OpenAsASCII)
>
>
>
> For Each sItem In aListitem
>
> kline = instr(sItem,strInput)
> pline = left(sItem,kline)
> fOutputFile.WriteLine pline
> kline = 0
>
> Next
> 'fOutputFile.close
>
> wscript.echo "Process Complete" [/B]
Never mind guys....I figured it out
--
nnanna
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------
- 15
- VB Scripts >> Collections in ASP and XML, using the Session Object (Part 1)Let's say that I have an xml file with:
<PRODUCTS>
<PRODUCT>
<SKU>AAA111</SKU>
<NAME>Name One</NAME>
<COLORS>
<COLOR><ID>BK</ID><PRICE>10</PRICE></COLOR>
<COLOR><ID>WH</ID><PRICE>20</PRICE></COLOR>
</COLORS>
</PRODUCT>
<PRODUCT>
<SKU>BBB222</SKU>
<NAME>Name Two</NAME>
<COLORS>
<COLOR><ID>BK</ID><PRICE>20</PRICE></COLOR>
<COLOR><ID>WH</ID><PRICE>30</PRICE></COLOR>
</COLORS>
</PRODUCT>
<PRODUCTS>
When the session starts, I want to create a Session Variable/Object
that can be used in ASPs later like this:
(Example Use in VBScript)
Dim colProducts
colProducts = Session("PRODUCTS")
For Each oProduct In colProducts
Response.Write(oMyProduct("SKU")
For Each oColor In oProduct("COLORS") ' Access a SUB collection
directly.
Response.Write(oColor("ID"))
Next
Next
oMyProduct = colProducts("AAA111")
Response.Write(oMyProduct("NAME"))
It has been a very long time since I coded, and so my code is probably
a bit rusty. Also, I have never really worked with collections.
My questions are:
1.) In my session_onstart code, how do I create a collection and store
it into the session variable? What language should I use? Code
Examples?
2.) In my ASPs, how do I propperly access those collections and
sub-collections? Languages? Code Examples?
Thanks in advance.
|
|
|