?

Log in

No account? Create an account
Sorry, should have done this sooner. - LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Sorry, should have done this sooner. [Jul. 14th, 2002|01:05 pm]
LiveJournal Client Discussions

lj_clients

[ljnp4u]
[music |Creed - My Own Prison. (WNRN)]

Somebody complained in support request http://www.livejournal.com/support/see_request.bml?id=57140 that his livejournal client would not open any of the links in his browser, so I made a patched version available for him in a reply, but that one is still screened.

Either way, the patch is this:


	//::ShellExecute(m_hWnd, "open", "http://www.livejournal.com/", NULL, NULL, NULL);
	SHELLEXECUTEINFO structExecution={0};
	structExecution.cbSize=sizeof(structExecution);
	structExecution.fMask=SEE_MASK_NOCLOSEPROCESS|SEE_MASK_FLAG_DDEWAIT;
	structExecution.lpVerb="open";
	char szCommand[MAX_PATH];
	HANDLE hFile=CreateFile("temp.htm",GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_NO_BUFFERING|FILE_FLAG_WRITE_THROUGH|FILE_FLAG_DELETE_ON_CLOSE,NULL);
	if (hFile!=INVALID_HANDLE_VALUE)
	{
		DWORD dwBytes=0;
		WriteFile(hFile,"<HTML> </HTML>",14,&dwBytes,NULL);
		FindExecutable("temp.htm","",szCommand);
		CloseHandle(hFile);
		structExecution.lpParameters="http://www.livejournal.com/";
		structExecution.lpFile=szCommand;
		structExecution.nShow=SW_SHOW;
		ShellExecuteEx(&structExecution);
	}


I can't remember where I stole it but basically it looks up the program with which to load ".htm" files, and then uses that to send the url to. Basically it uses the users's default browser, whatever that may be.
linkReply

Comments:
From: erin
2002-07-14 04:26 am (UTC)
hey hun...lj-cut...the code is killing my friends page
(Reply) (Thread)
[User Picture]From: rahaeli
2002-07-14 04:33 am (UTC)
Just to let you know, due to licensing issues, you can't distribute a binary of the lj_win32 client without also including the GPL and the source code. Also, you're probably not working with the latest code, as the code for the beta hasn't been released yet.

You probably want to get in touch with visions, who's the author and maintainer of the Windows MFC client, to make him aware of the problem and submit your patch. It'd be easiest for everyone if you took down your distribution, because that can create ugly licensing problems.

Thanks :)
(Reply) (Thread)
[User Picture]From: ljnp4u
2002-07-14 04:52 am (UTC)

Re:

I'm not planning on distributing it, I'd just want the submitter of the problem to check first if this solves his problem before actually doing something about it. There may still be another problem. I did remove the link to the .exe though.
(Reply) (Parent) (Thread)
[User Picture]From: dottey
2002-07-14 05:19 am (UTC)
By giving it out to anyone, I think that is called distribution.
(Reply) (Parent) (Thread)
[User Picture]From: ljnp4u
2002-07-14 05:27 am (UTC)

Re:

Either way, except for these temp snippets, nothing has changed to the code and nothing has changed or is to be changed to the GPL that goes with the original. It *is* the original. Just a temporary modification to test something.

I could have removed like 95% of the code to make it non functional as a livejournal client and only test the way links are opened on the persons computer, but yeah, why doing it the hard way if it can be done in a simple way ?
(Reply) (Parent) (Thread)
[User Picture]From: dottey
2002-07-14 05:40 am (UTC)

Re:

I just think your intentions were different than what you actually did. Distribution is distribution.
(Reply) (Parent) (Thread)
[User Picture]From: xb95
2002-07-14 10:12 am (UTC)
That's far more difficult than necessary. If you execute the link, Windows is smart enough to load the default browser. The code that my client (LochJournal) uses looks like this:

ShellExecute(Handle, nil, PChar(sURL), nil, nil, SW_SHOWNORMAL);

This is Pascal, but you should be able to convert it to C/C++ without too much trouble. Try it out though, just execute the link--Windows is pretty smart. :)
(Reply) (Thread)
[User Picture]From: ljnp4u
2002-07-14 10:26 am (UTC)

Re:

Unfortunately not for everyone it seems, I don't know what the windows version was that the person had, and wether or not he had made some changes that stopped the normal way of opening links from working, but the old method (which doesn't differ much from yours, as it is what I have commented out on top) didn't work for the person reporting the problem. Another thing that happened with the old code is that it will not open in a new browser window. So if you are writing a livejournal entry and suddenly want to check your friends list, you risk losing your entire entry. My method opens the link in a new browser window and I fount this either on the web or on MSDN regarding this problem. It is a preferred way to open a link using the default browser. So I don't think it's that irrellevant. Let's just wait until the person finds time to test it and see if it solves his problem.
(Reply) (Parent) (Thread)