Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News System (Pulled from URL)
#1
Okay, this is a simple tut. Very simple actually. First off..

Open up your client source. Add the component..

Code:
Microsoft Internet Transfer Control 6.0

Now, place that component (INet) on frmMainMenu..

Name it..

Code:
InetNews

Now, if you wish to use colors, images, and such in your news box, add a rich text box (I won't go into explanation for adding images/color), otherwise, add a normal text box.

Name it..

Code:
txtNews

Add this sub, if you don't already have it, if you do, just add the code inside this sub..

Code:
Private Sub Form_Load()
Dim TmpStr As String

    TmpStr = InetNews.OpenURL("http://tpo.phpnet.us/News.txt")

    txtNews.Text = TmpStr
End Sub

I left my test url in there, just replace it with the url you will use.

And that's it. It will now pull the text from the text file in the url.

Enjoy!

Later, I will write one to pull the news from the game's server, which also, isn't hard.

Hope this helps someone.
Reply
#2
Wow, this is so much easier than my system lol... at the current point in time , due to my newb programming skills and lack of ability to think, my game only displays the news once you log in to the game. This should come in handy.. thanks Smile.


EDIT: Works, thanks a lot.
Reply
#3
just asking, but in a way couldnt you use that for accounts ect ? on a site ? all you would have to do is on server figure out away of sending via ftp. or if ur sever is the site host should be even simpler lol.
Reply
#4
Its called a mysql database, and theres a link to mse running from one somewhere on this site =P
Reply
#5
how can I make the inetNews use a url from an ini file?
Reply
#6
Add the getvar and putvar subs to your source and use that.

url = getvar((app.path & "whatever.ini"), "NEWS", "URL")

Or something like that. Doesn't much make a difference.
Reply
#7
I have
Code:
Dim TmpStr As String
Dim URLPath as string

    URLPath = GetVar(App.Path & "\Config\News.ini", "NEWS", "PATH")

    URLPath = InetNews.OpenURL

    txtNews.Text = URLPath

Doesent work though Sad
Reply
#8
Not tested, but I think it will work...

Code:
Private Sub Form_Load()
Dim TmpStr As String
Dim UrlPath As String
    
    UrlParth = GetVar(App.Path & "\Config\News.ini", "NEWS", "PATH")
    TmpStr = InetNews.OpenURL("UrlPath")

    txtNews.Text = TmpStr
End Sub
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)