|
No, because there is no query. I suggested either a trigger or counting it in your app. Neither requires a query.
|
|
|
|
|
Hi all,
I have tried posting the dedicates subjects, but it seems that knowone has the knowledge or just so obnoxious they dont care for any other language and as soon as you mention VB or .net well thats it....see u later
Out of all the .net languages i prefer VB.net, its just easier to work with.
So does anyone in here know anything about MFC apps, first i would like to convert an MFC windows app to a MFC console app and then wrap it in MC++ with the #pragma umanaged and #prama managed blocks.
Once i have this working i can create a .net DLL, instead of the console app, this DLL with import straight into a VB.net application and allow me to leverage the COM method within the API and also have the .net functionality.
I explain this because, i would not expect every VB coder to understand this but someone with C++/MC++ should understand without thinking.......NOT! http://www.codeproject.com/script/Forums/View.aspx?fid=3785&msg=2565053[^]
All i'm asking here is what i need to do you make the existing MFC app, that has windows etc.., into a console app - like a DOS prompt.
Thanks
|
|
|
|
|
you're talking about a significant amount of effort - it doesnt even translate 1 for 1 - it depends on lots of things eg how much input is coming from the dialog etc if the MFC app is using a dialog for input .. while I dont agree of the way you've treated 'led mike' or your 'just so obnoxious' comment, Id start like this ...
1) Ascertain all the dialog inputs from the MFC program - maybe design an XML file or such that will be read by the console program, and feed it as an argument on the command line
2) Look at all the calculation logic in the MFC program - it could be spread across all sorts of classes/locations. If you have discrete classes, single them out for inclusion into the console program, else bundle all the code etc, think about where in the console prog it will sit/be accessed - under main() for instance
3) any output from the MFC that went to a listbox for example, and the results of your calculations can be output to cout, cerr etc using iostreams
but I suspect you'll already have thought of all that
'g'
|
|
|
|
|
The application uses an API to access the currency exchange, the application was design by the company that allows this access - and by modern stardards is not very good.
this app is pretty simple, by this i mean its just got one menu and about 6 items in the menu, when selected by the user the API writes the info to a log window, and like you say my plan was to capture this in a console window with cout etc...
yes your right about the classes being spread about, this is the MFC stuff which is why i've included the the MFC classes in the console application.
my question here would be this, is there any difference in solution settings from an MFC app to a console app. By this a mean what tells the compiler to run if you comment all the code in the MFC app and paste the code from a console app it will not run!
andy
|
|
|
|
|
Fu Manchu wrote: is there any difference in solution settings from an MFC app to a console app
I would have thought, heaps, plus the non-inclusion of the MFC code libs/dlls etc - you could check by generating two projects, one MFC, one console, and comparing their make files. "In general" I have added MFC support to a console app - for CString etc, but the dialog stuff (for example) yeesh, not game to try it, although I have seen others do it with a wrapper or two (add a dialog or such)
thats why I think you'll only be porting the calc/logic to your console program, the rest - toast !! (once you have all the logic/calcs isolated, you could almost go to a dll anyway couldnt you ?)
'g'
|
|
|
|
|
sorry, that exactly what i'm doing i dont care for the windows stuff and dialogs - i'm just trying to get the business logic end that connects to the API - the rest can be done in .net
so you reckon its possible, basically i just want to have a class C++ that i can wrap in MC++. i would call the method etc from .net and get the returned data.
|
|
|
|
|
yeah - if you factor the class so that it has a setup/init stage where you feed it paras etc then a do_it() method that returns the result or a seperate get_result() method, then you're in good stead
'g'
|
|
|
|
|
hi all,
i want to get the list of all Application , that are currently running on my computer and which is listed in Application tab of Windows Task manager.
anybody have idea that how can i perform this task ?
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
the anwser is .....Imports System.Diagnostics.Process with is not that obvious
Imports System.Diagnostics.Process
Module Module1
Sub Main()
Dim myProcess() As Process = Process.GetProcesses()
For Each proc As Process In myProcess
Console.WriteLine("Process: {0} ID: {1}", proc.ProcessName, proc.Id)
Next
End Sub
End Module
Andy
|
|
|
|
|
imports system.diagnostics
Public Sub showProcesses()
Dim W As Object
Dim sQuery As String
Dim processes As Object
Dim process As Object
W = GetObject("winmgmts:")
sQuery = "SELECT * FROM win32_process"
processes = W.execquery(sQuery)
For Each process In processes
MsgBox(process.Name) 'you can also get the process.Handle
Next
W = Nothing
processes = Nothing
process = Nothing
End Sub
This function get the name of all running process Names.
Thanx
Mitesh Khatri
khatrimitesh@hotmail.com
|
|
|
|
|
|
Dear All,
I have a problem
If I insert values from text boxes as 3, +, 2 and I catch it for string variables.
a = textbox1.text
b = textboxt2.text
c = textbox3.text
Then I want to calculate those values
ex: total = 3+2
virtually,
total = a b c (because b="+")
How can I do this,
please help
Thanks
|
|
|
|
|
want you have here is a casting problem. i guess that you want have the option to have different operators in the in 'b' so you could do basic maths operation....+ \ - *
if this is so...what i would so is have b a dropdownlist or combobox with the selection fixed and maybe have it defaulted to '+'
the next thing to do if make textbox 'a' and 'c' only except numbers, you can find many example of this on the web
and once you have done this because you know that only number are going be entered you can cast the strings to ints
i.e.
Dim int1 As Integer = CType(textbox1, Integer)
Dim int2 As Integer = CType(textbox3, Integer)
then based on the selection do a case select to do the calculation
hope this is what you wanted....
|
|
|
|
|
Thank you very much Fu Manchu,
Yes, it is ok for a and c. But how can I include b ("+" or may be "-", "*", "/" something like that). Becuase the operator is as in the textbox text, therefore I want to it convert to operator and also, include into equation. Is it possible??
If I describe further, there are three texboxes in the application. So user can type values in 1st and 3rd textboxes and operator (may be one of these +, -, *, /) in 2nd text box. Then application should give the results.
help me,
Thanks
|
|
|
|
|
Hi All,
how to get Numeric values from a String Variable through Regular Expressions in VB.Net.
i have a string variable and it contains string Data and Numeric values,
i need to extract the Numeric value.
Example :
strData="FM*kl-Class Oyr 563"
strData="FM*kl-Class Oyr 563.21"
Out put= 563
Out put= 563.21
i expect your valuable help.
By
George Garvasis
|
|
|
|
|
George, thats pretty much info google can show you. Why dont you try to put a regex together for it and then come back when that doesnt give you quite what you expect - honestly, a regex to do what you've asked is quite easy
georgegarvasis wrote: i expect your valuable help.
I'd suggest you try to be a bit more polite - you're likely to be shredded by the regulars if they see that !!! (if not, completely ignored)
'g'
|
|
|
|
|
I have a question involving how to list more than one condition for a while loop
I understand how the while loop works but I don't know how to make one that needs to meet more than 1 requirement (other than using a while loop inside of another while loop which I want to try and avoid)
I figure I would separate conditions by or but that only results in an overflow
Help please!
Example
Public Class Form1
Dim x, y, z, n, disp As Short
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
n = 0
x = 0
y = 1
z = 2
While n = x Or y Or z
n += 1
disp += 1
End While
Label1.Text = "The loop ran " & disp & " times."
End Sub
End Class
|
|
|
|
|
mark192 wrote: While n = x Or y Or z
Kinda rusty with VB, but I think it should be:
While n = x Or n = y Or n = z
|
|
|
|
|
wow thanks alot!
I can't believe I was leaving out the n = after the or
|
|
|
|
|
We all went through that phase. x = y or z is natural in the way of human thinking.
|
|
|
|
|
Hey developers.
Now before i even get to the asking, id like you to know that am a total n00b to programming, so please try to phrase your answers in the simplest form also... (in a form i like to think of as 'idiot-proof' )
THE CHALLENGE
Now, I'm trying to create a small program which is required to locate the occurences of any pre-determined character, word, block of characters, basically any search strings, which is entered by a user in a textbox.The search string should be highlighted in some way in the plain text file (.txt).
When a user instigates a search, all occurences of matching the string should be recorded & stored into suitable array. This array should build up information about the occurences in the text of a number of strings and at any stage in a session, a user may request a summary of all this information to display in such a way to show the frequency in the text of each search string.
I'm using a Rich Text Box control to hold the text and the IndexOf method to for the search function. Am also using the Stream reader function to import the text file and am also planning to use it to write to a separate text file.
MY SOLUTION (which is flopping a whole lot more than i expected... )
Using the above controls and methods (RichTextBox, StreamReader, IndexOf)i've created a simple user interface and in it i've written the following code:
'Import missing system class libraries
Imports System.Text.RegularExpressions
Public Class frmMain
Public Function SearchText(ByVal textToFind As String, _
Optional ByVal startPosition As Integer = 0, Optional _
ByVal endPosition As Integer = 0, Optional _
ByVal highlightText As Boolean = True, Optional _
ByVal matchCase As Boolean = False) As Integer
'
'Contains the return value of the search. IT it returns -1, then a match was not found.
Dim i As Integer
Dim LastWordinRichText As Integer
Dim fromFirstWord As Integer
LastWordinRichText = rtbContent.Text.LastIndexOf(textToFind)
For fromFirstWord = 0 To LastWordinRichText
txtIndexLocation.Text = startPosition
If endPosition < 1 Then
If Not matchCase Then
textToFind = textToFind.ToLower
Dim temp As String = rtbContent.Text.ToLower
i = temp.IndexOf(textToFind, startPosition, Me.Text.Length)
Else
i = rtbContent.Text.IndexOf(textToFind, startPosition, Me.Text.Length)
End If
Else
If matchCase = False Then
textToFind = textToFind.ToLower
Dim temp As String = rtbContent.Text.ToLower
i = temp.IndexOf(textToFind, startPosition, endPosition)
Else
i = rtbContent.Text.IndexOf(textToFind, startPosition, endPosition)
End If
End If
If i > -1 Then
If highlightText Then
rtbContent.Focus()
rtbContent.SelectionStart = i
rtbContent.SelectionLength = textToFind.Length
End If
startPosition = startPosition + 1
End If
'
'Returns the position where the text was found , otherwise it will report -1 which
'means that the search string was not found.
Next
Return i
End Function
Private Sub tsExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsExit.Click
Me.Close()
End Sub
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
SearchText(txtSearch.Text)
End Sub
Private Sub NewSessionToolStripMenuItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles NewSessionToolStripMenuItem.Click
'Open a new file dialog box to browse for a text file which can be opened for analysis.
'Variable declaration
Dim Open As New OpenFileDialog()
Dim myStreamReader As System.IO.StreamReader
Open.Filter = "Plain Text Files (*.txt)|*.txt|All files (*.*)|*.*"
Open.CheckFileExists = True
Open.ShowDialog(Me)
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
rtbContent.Text = myStreamReader.ReadToEnd()
Me.Text = "Text Editor - " & Open.FileName
Catch ex As Exception
' Do nothing on Exception
End Try
End Sub
Private Sub SaveCurrentSessionToolStripMenuItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles SaveCurrentSessionToolStripMenuItem.Click
'Open a new dialog box to save current session file.
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text Files (*.txt)|*.txt|All files (*.*)|*.*"
Save.CheckPathExists = True
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(txtSearch.Text)
myStreamWriter.Flush()
Me.Text = "Text Editor - " & Save.FileName
Catch ex As Exception
' Do nothing on Exception
End Try
End Sub
End Class
MY PROBLEM
Nothing works. Except for the importing of text files function, nothing else works. I think its something to do with the Public SearchText function which is triggered by clicking on the search button (btnSearch). i've gone over the code again and again, but the thing won't crack.
Someone please examine the code and point me in the right direction, and if possible suggest alternative ways to do using still the same controls and methods. All help, tips, tricks and suggestions will be highly appreciated. And if there is a similar request which i might have missed when i was searching the threads, please give me the link to the thread.
Thanks y'all.
Steve.
You can email me on nexxus89@hotmail.com
Live it. Learn it.
|
|
|
|
|
Have you tried debugging line by line?
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hi,
I have to develop application where I need to read a file and create a report and then print it on any printer on LAN. I am free to write in any way. I think of using crystalreport supplying data from incoming file. But the crystal report doesnt take any text file as data source. Also when i print through windows service, it always give default printer not selected. Please advice how should i build this solution ? An eraly reply would be highly appreciated.
Thanks!!!
|
|
|
|
|
I think I would create a "properties/Settings" app that allows you to select the output printer and store the details in the registry.
Then write your windows service that gets the details from the registry for printing, therefore you can tell Crystal what printer to use rather than the default printer.
With regards to the text file, I would load the text into a Typed Dataset then pass the dataset to crystal as the data source.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Hi Steve,
Thanks for the reply. I am new to VB programming, can you also provide some code to me.
Thnks in advance.
|
|
|
|
|