Mr.M 89 Future Programmers

Yeah, this whole project consist of 5 parts which I don't want them to be done by the same program, so the best approach or method I thought of was to have the VB5.0 to do these apps that will do the data transmission (sharing) this way the I will have another app which is the app I will do in VS2010 to read this text file and split each record accordingly so that it will be inserted in to a database then the very same app will also listen for external client connection on another port.

So this will for now be connected by 2 types of clients namely (Windows Forms based clients, and Android based clients) so that's where the VS2010 will come in handy. The main reason why I didn't want to use it throughout the project was that there are some parts where I don't want an installable program only stand alone program.

Now coming back to the topic. I've managed to solved this with the help I found on this site: http://www.vbforums.com/showthread.php?624135-Help-with-winsock-data-arrival

Thank you so much.

Mr.M 89 Future Programmers

Lol. Well I do use VB.NET 2010 but for this project I'm developing I find VB5.0 a bit easy its not too complicated with connections or so like the Sockets in VS. In VB5.0 you only drag the Winsock and assign properties then start listening/connection request.

Well I've manage to find something that helps but with this the problem is that its only works perfect when its likes. For now I have updated my text file and now I'm having 5 lines and I want on the client side to also split or separate the message so that I can write this lines exactly as they are on a server.

Sometimes the file created on the client is 810Bytes which when its this size if I open the file I find everything in place as its suppose to, but if I delete the file on the client side and rerun my app its sometimes create a file with 702Bytes, this is mostly created even if I didn't delete the file I will get the whole message in just 1 or 2/3/4 lines only once often I get 5 lines.

I don't know why is this odd activity is happening. I've used the DoEvents after Winsock1.SendData myLine but I have to write 12 times the DoEvents in order to be able to at least get the 810 or 805Bytes which appear to be how I want it but this is done rarely maybe once in 6 or 10 tries.

Some articles …

Mr.M 89 Future Programmers

Thanks but that didn't work. Or maybe I'm doing it wrong. I'm using VB5.0

Mr.M 89 Future Programmers

Hi Dw.

I'm having a client server which the server read a text file line by line and send each line to the client upon client connection.

The problem I'm having is that on the client side the data is combined, meaning I get all lines that are on the file at once but what I want is to get each line just like how it is sent. This is the server side code I have.

Dim myFileName As String
Dim myLine As String
Dim FileNum As Long
myFileName = "c:\myfile.txt"
FileNum = FreeFile
Close FileNum
Open myFileName For Input As FileNum
Do While Not EOF(FileNum)
Line Input #FileNum, myLine
Winsock1.SendData myLine
' MsgBox myLine
Loop

For now the file only consist of 2 lines but the client display a message containing all the text file data in one message box but it should be displaying two messages.

Here is my client side DataArrival code:

 Dim strData As String
 Winsock1.GetData strData, vbString
 MsgBox strData

I think I should use a For Each strData but don't know how. Anyone who knows a better solution.

Mr.M 89 Future Programmers

Don't it need reboot or something after you performed that so that the effect can be visible or take effect? try restarting your computer after firing that code and see.

Mr.M 89 Future Programmers

Glad you figured the way out.

Mr.M 89 Future Programmers

Sorry to post the answer now was a bit busy. I used a audio recorder and a screen recorder then they both create their own files on the disc and they both start recording and stop recording sametime even though at the moment its not 100% the lengths but the ffmpeg tool to combine audio and video together to get one AVI file that has both audio and video.

Mr.M 89 Future Programmers

Ok. I have just looked through the code and half of the attachment because of my internet. But I have some Questions.

Why you have

 With ProgressBar1
.Style = ProgressBarStyle.Blocks
.Step = 1
.Minimum = _MinProgressbarValue
.Maximum = _MaxProgressbarValue
.Value = _ProgressbarValue
End With

Twice and also why > because if the progress value is more then 100 the error is thrown?

Also if you say you are using a MDI then try something like this:

For Each xChild As Form In Me.MdiParent.MdiChildren
xChild.Close()
Next xChild

To see if all active child forms won't close.

Mr.M 89 Future Programmers

Try using a timer instead and on a timer put something like this:

If ProgressBar1.Maximum = 100 Then
close()
End If

Then you will have to add the Timer1.Start() on your Form_Load

Mr.M 89 Future Programmers

Well just looked around within this site and found a similar post which already has an answer to this question. This question is a duplicate.

Mr.M 89 Future Programmers
Mr.M 89 Future Programmers

Lol @jamesCherrill. ;-)

Mr.M 89 Future Programmers

@nullptr I tried that but I got this error error C2664: 'WFSOpen' :cannot convert parameter 9 from 'HSERVICE' to 'LPHSERVICE'

What I think I will have to clear out is that the code on my first post is written outside the

BOOL    Wfs_Open(LPHSERVICE lphService)
{

}

block because I'm using the console and I wanted to display the error because I failed to map the messages, so the code on the first post is called as is under the

if(Wfs_Startup())
{
cout << "Started service" << endl;
cout << "Opening a session" << endl;
// The code on the first post here
// as well as all the checkings of all functions
// if they fail which is
// fSuccess=EXIT_FAILURE;
}

So I'm not sure wherther the problem is because this call is called outside the Wfs_Open() function or.

Mr.M 89 Future Programmers

Hi, I get "first-chance exception at 0x1000161f in myapp.exe: 0c0000005: Access violation reading location 0x00000000."

If i execute the WFSOpen command. To be able to receive the error pointing to the correct error value I've done this:

LPHSERVICE lphService;
lphService = 0; // I put 0 because the EXIT_SUCCESS is also 0
HRESULT hResult;
WFSVERSION SvcVersion, SpiVersion;
char szLogicalName[]="Epson1200";
hResult = (WFSOpen(szLogicalName,WFS_DEFAULT_HAPP,"Epson Print",WFS_TRACE_NONE,TWO_MINUTES,RECOGNISED_VERSIONS,&SvcVersion,&SpiVersion,lphService));

if(hResult == WFS_ERR_CANCELED)
{
cout << WFS_ERR_CANCELED << endl; // This returns -4
}else if(hResult == WFS_ERR_SERVICE_NOT_FOUND)
{
cout << WFS_ERR_SERVICE_NOT_FOUND << endl; // This is -43
}else if(hResult == WFS_ERR_CONNECTION_LOST)
{
cout << WFS_ERR_CONNECTION_LOST << endl; // -54
}else if(hResult == WFS_ERR_INTERNAL_ERROR)
{
cout << WFS_ERR_INTERNAL_ERROR << endl; // -15
}else if(hResult == WFS_ERR_INVALID_APP_HANDLE)
{
cout << WFS_ERR_INVALID_APP_HANDLE << endl; // -17
}else if(hResult == WFS_ERR_INVALID_POINTER)
{
cout << WFS_ERR_INVALID_POINTER << endl; // This is the error I get which is -26
}

I get the (-26) which says "A pointer parameter does not point to accessible memory when you refer to the cen documentation.

Any one know which pointer is refered to by this error here?

Thanks

Mr.M 89 Future Programmers

Thanks. Sorry to take so long but I was busy with other projects. Well now my problem is that even if I've set the values but they are not being saved to the registry.

I have another working program I've downloaded which does change my MAC address but when I'm using mine, the above code (btn_update) the keys/values are not being saved to the registry even after I've disabled and enabled the adapter but still my this code doesn't update the registry.

Is there any thing I'm missing out here or perhaps is there any better way to write to the registry?

Mr.M 89 Future Programmers

If you say file attached are you referring to files added as Resource file within your project or? I couldn't open your file due to that I'm currently using VS2010 and you used VS2015.

Mr.M 89 Future Programmers

Which part doesn't work? The code is to guide and also give idea of how it can be done. As a coder you should have an idea.

About your Linux, if its within this forum will check it out.

Mr.M 89 Future Programmers

Ok will try that out and see and I will get back to you.

Mr.M 89 Future Programmers

I've tried that but the problem was the same. The problem is that I call the Close()

Mr.M 89 Future Programmers

Just found what I'm looking for. Its called ExitCode. Will post the link to the site where I've found it. I've been trying to post but my post wasn't submitted, the link is: https://msdn.microsoft.com/en-us/library/system.diagnostics.process.exitcode(v=vs.110).aspx

Mr.M 89 Future Programmers

To just answer your question of what's lock the file, the reason why I'm getting that error is because or should I say its occur only if the files are a bit longer e.g.( V.mp4 is 00:01:09 and M.wav let's say its 00:02:05 because the times are not equal when stopping the recording so that's why I have files with different lengths) so if I marge them up it will take sometime before the final product/output is fully created so the backgroundwork does wait its time and then fire the delete code under the WorkComplete but because Proc1 on the other side is not done, is still using these file or is still merging(the files will remain in used by it till it done) that's why I'm getting that error sometimes not always as I've said its depends on the file lengths.

What I want is a way of checking if the proc1 is done or perhaps be able to get its status whether its done or busy so that when busy I will wait but when done I will delete these files.

I think its now clear.

Mr.M 89 Future Programmers

Hi Dw.

I have a project that uses Process to marge some files, now because the merging can take quite sometime I've used BackgroundWork. The main problem I'm facing is to know when the Process is done because I want to delete the files that it was merging with so that the file will only contain the finished output which is a file that is produced by merging these other files.

I have this code.

 Private proc1 As New Process


 proc1.StartInfo.FileName = Application.StartupPath & "\ffmpeg.exe"
 proc1.StartInfo.Arguments = String.Format(" -I " & "C:\V.mp4" & " -I " & "C:\M.wav c:\final.mp4")
 proc1.StartInfo.UseShellExecute = False
 proc1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
 proc1.StartInfo.RedirectStandardInput = True
 proc1.StartInfo.RedirectStandardOutput = True
 proc1.StartInfo.CreateNoWindow = True
 proc1.Start()

Now I need to know when this process is done. I've tried this:

 If proc1.HasExited Then
 Kill("C:\V.mp4")
 Kill("C:\M.wav")
 End if

But sometime is points to Kill("C:\V.mp4") and it says its can't delete this file because another process is busy with this file.

Anyone knows how I can solve this problem?

Mr.M 89 Future Programmers

What is your question exactly? Where are you having problem?

Mr.M 89 Future Programmers

If you feel that your question has been answered you might consider marking your question as solved.

Mr.M 89 Future Programmers

You click a button, select a folder, default directory is desktop, clikc ok

Me.FolderBrowserDialog1.RootFolder = Environment.SpecialFolder.Desktop

any pictures that are supported in the selected directory are shown in a listview

Dim dir_info As New IO.DirectoryInfo(FolderBrowserDialog1.SelectedPath)
    Dim AllFiles As IO.FileInfo() = dir_info.GetFiles("*.gif", IO.SearchOption.AllDirectories)
    Dim FileName As IO.FileInfo
    For Each FileName In AllFiles
    ListView1.Items.Add(FileName.ToString)
    Next

You click a photo in the listbox, it will show you it in a picturebox

PictureBox1.Image = Image.FromFile(ListView1.SelectedItems(0).Text)

There will be controls at the bottom, like opening the selected photo in MS Paint, setting the photo as your desktop background, rotating... etc

Well you can do now your research on that I wont feed with everything.

Mr.M 89 Future Programmers

Well I think you have just answered your question on your second post. You know which tool, component to include within your project, so don't be lazy just get started coding. As just JIM has stated, if you don't know how you can just simply break your project in to parts and search how to do one piece at a time till you complete the entire project.

Mr.M 89 Future Programmers

I think your computer is infected with a virus.

Mr.M 89 Future Programmers

What I mean is that how can I click a button and wait for the site to finish loading or perhaps if its possible the get the "Done" status message just like how IE displays the done status message when done loading.

I don't want to use the sleep method.

Mr.M 89 Future Programmers

I'm having the below code which works fine. The code is for typing some text on a website text field. In my case my site only have 2 components( it one TextBox, and one Button) the app simply loads this site and then auto type in the textbox field then automatically click the submit button. Now what I want is to wait for the respond because normally the site verifies the keys you entered then if the keys match one on database then its redirects you to homepage so what I want now is to get the response if the entered digit matched or not.

Here is the code I have to enter and submit data:

 Dim usernameTextBox As HtmlElement = Me.WebBrowser1.Document.All.Item("SomeSiteTextHere")
 usernameTextBox.InnerText = "MyTextHere_ToBeAutoTyped"
 Dim elements = WebBrowser1.Document.GetElementsByTagName("input")
 For Each element As HtmlElement In elements
 If element.GetAttribute("className") = "button requires-tou" Then
 element.InvokeMember("click")
 Exit For
 End If

That's for auto typing and submitting. Now on my WebBrowser1_DocumentComplete I have the following, but first I first try to go to google that means upon giving or typing the matching text the site will redirect to http://www.google.com not on homepage.

Here's is my DocumentComplete code.

 REM: First Im checking if the returned Url is of google or not, if its from google then I assume the text matched.


 If WebBrowser1.Url.Host.Contains("google.com") Then
 MsgBox("Matched")
 Else
 REM: That didnt match so try again.
 REM: Calling the function to auto type here.
 End If

Now this doesn't give time for …

Mr.M 89 Future Programmers

Hi Dw.

I'm new to C++ nor Win32 app dev. I want my app to stay open or running even if I'm not interacting with it. And how to write a close call.

In VB to close it you just right:

 Close()

How can I achieve these two? Also how to remove the title bar as well with those 3 buttons(minimize,maximize,close)?

Mr.M 89 Future Programmers

So how should I solve this? sorry I'm new to C++.

Mr.M 89 Future Programmers

Thanks, the question has already been answered as to @Minimalist. I'm using a Phone at the moment and the option to mark thread solved is not visible.

Mr.M 89 Future Programmers

I'm getting "error C2039: 'AllocSysString' : is not a member of 'System::Char' error.

I'm trying to assign the result to a string variable.

 wchar_t str;
 return str.AllocSysString();

But I'm getting the above error.

Mr.M 89 Future Programmers

@ddanbe, no, I didn't mean that. What I meant was that mmmmm let's make Visual Studio an example. The extension (.sln) is not recognized within Windows to which application can open it if you haven't installed Visual Studio on your computer, but once you have installed it, then the (.sln) will change to Visual Studio. (Not sure if you understand), another example is (.docx) which was introduced in Microsoft Word 2010 I think because before that it was (.doc) so the (.docx) maybe recognized by MS Word 2003 but won't be supported or opened till you install MS-Word 2010 or higher so with this extension file in your computer but not having MS-Word installed its will be of unknown.

One more last example is (.pdf) if you have this file but don't have Adobe Reader installed you won't be able to open this file. So coming back to my question, how to make my file extension have my own icon, like (.pdf) will have the Adobe Reader icon, (.txt) will have text icon, (.doc) will have Microsoft Word icon, (.xls) will have Microsoft Excel icon if Microsoft is installed?

Hope that's clear now.

Mr.M 89 Future Programmers

@Oxiegen, I think you are right. A server can be a relay if client1 wants to send data to client10 this will go through server maybe with a username to be sent to like"To:@Alice-(data)" then the username will be resolved by server to get the ip for client10 or locate ip for client10 from the collection then the server send data to client10 with a client1 username like "From:@Bob-(data)", only in server the usernames/IPs will be resolved vise verse ( if the message contains Ip then that Ip will be resolved to correct Username, if its username then the username will be resolved to Ip)

The problem is to send this messages to their directed targets within this 10 clients and also not broadcasting it to all by only the targeted client.

Mr.M 89 Future Programmers

Meant If the OP doesn't add or use any Container not control panel.

Mr.M 89 Future Programmers

Ok. Firstly. The Timer(tool) is just a timer that when you add to your app its doesn't show or visible on run time, I will say its a service, and the Timer(time) that you want can be achieved in I think two or three ways depending on your plan. But that require another thread as this thread question seems to be answered as you said above.

Mark thread solve, then search first if there hasn't been any questions already answered with your timer based question, then if not or yours is different from your findings then you can start another thread.

Mr.M 89 Future Programmers

I just saw the post. I think if the OP will have more then one question and also his answers are based on radio buttons that will be a problem if the OP have more questions and not to mention the time it will take to code for displaying the relavent questions. Group boxs simplifies all that because all you have to do is show/hide only a group box instead of coding to show/hide one by one. But in this Q, I will second you on that the OP can also not use the Group box because here the OP is using TextBoxs and Labels which he can use them multiple times for different questions. But again it depends on the simplicity and the number of main Questions (Question1,2,3...).

Mr.M 89 Future Programmers

But what if the OP wants to have many questions, "GUI" based how will the OP sort an keep track of the questions and their core questions? Don't you think it will be a problem if the OP has maybe lets say 20 Questions and on each Question the OP has lets say 10, don't you think that will be a problem? not to mention that the OP here is using the radio buttons which only enables you to check one within the group or control so if the OP doesn't add any Control panel like Group Box to group the corresponding questions to gether he will have a problem in determining the right or wrong question on Question 1.2.

Mr.M 89 Future Programmers

Heres the sample I did. Check the attachments

Mr.M 89 Future Programmers

I think you need to include the source that works with strings #include "strmp.h" try that and see.

Mr.M 89 Future Programmers

What is your problem here? Post some code if it code related.

Mr.M 89 Future Programmers

Ow, the site use to have ads, to download click the download, don't follow suspicious prompts, I tried to upload it here but wasn't allowed. The file is a .rar file and inside has a VS2010 project, not exe or so, just a project.

Mr.M 89 Future Programmers

This is not a place for home work, Read Rules. You need to show us what you have done so far and where are you having a problem. Post your code here.

Mr.M 89 Future Programmers

Since you are using radio buttons, all you have to do is to determine which radio buttons are the correct answer and which one are not the correct answer so that when you check the correct answer the app will know that this is correct or not.

If radAnswer1.Checked Then 'Suppose this is the correct answer
MsgBox("Correct")
Else
MsgBox("Incorrect")
End If
Mr.M 89 Future Programmers

The sample could be found Click Here: as per your request.

Mr.M 89 Future Programmers

The answers will be hard coded for validation/comparing the entered answer and a correct answer? If so,

I once created just a sample learners driving test app (its was to test if the user is ready to go take a learners exam)

I had done it this way:

Each section/question is on its own group box and when clicking next button the currently visible groupbox will be invisible or hidden and the next groupbox will be shown.

For answers the score received are assigned to a variable (e.g: Q1Score) for score received on question 1 and so on then I had a label that display the current score its update the score as you answer.

I think that's a more easy method, but someone might have a more better method.

Mr.M 89 Future Programmers

Hi Dw.

Firstly I would like to ask if there is anyone know a good download link to download VB6.0 I'm in need of this IDE.

Now coming to my actual question of how to detect USB insertion and removal and get a drive letter for it in VB5.0?

Thank you Dw.

Mr.M 89 Future Programmers

Eish. That's a problem...

Mr.M 89 Future Programmers

Hi Dw.

Is it possible to search through ".COM", ".exe" files and check if they are encrypted and so check which encryption was used in VB.NET?