Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
K

KEL3

@KEL3
About
Posts
27
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Hide the cmd window using createprocess function
    K KEL3

    Your problem is in the Flags: sInfo.dwFlags = STARTF_USESHOWWINDOW;

    		PROCESS\_INFORMATION pInfo;
    		STARTUPINFOA sInfo;
    		sInfo.cb = sizeof(STARTUPINFOA);
    		sInfo.lpReserved = NULL;
    		sInfo.lpReserved2 = NULL;
    		sInfo.cbReserved2 = 0;
    		sInfo.lpDesktop = NULL;
    		sInfo.lpTitle = NULL;
    		sInfo.dwFlags = STARTF\_USESHOWWINDOW;
    		sInfo.dwX = 0;
    		sInfo.dwY = 0;
    		sInfo.dwFillAttribute = 0;
    		sInfo.wShowWindow = SW\_HIDE;
    
    		BOOL ret = ::CreateProcess(m\_PathToExe, lpExePlusArgs, NULL, NULL, FALSE, 0, NULL, NULL, &sInfo, &pInfo);
    
    		if(ret)
    		{
    			// Wait until application has terminated
    			WaitForSingleObject(pInfo.hProcess, INFINITE);
    
    			// Close process and thread handles
    			::CloseHandle(pInfo.hThread);
    			::CloseHandle(pInfo.hProcess);
    		}
    

    Read MSDN carefully and with patience.

    kostas KEL

    C / C++ / MFC

  • Button Press Simulation... [modified]
    K KEL3

    Yes. That is a problem. However, if I learn how to do it once, then I could do it easier and faster the next time(s). And in the process of trying, I will learn new things. As a poet would say (I don't like poetry by the way...) it's more about the journey, not the destination. ;)

    kostas KEL

    ASP.NET

  • Button Press Simulation... [modified]
    K KEL3

    On second review, it seems that Rapidshare is well protected so that download-manager-makers have a hard time... Perhaps I should post a question here : http://www.hackforums.net[^] :sigh:

    kostas KEL

    ASP.NET

  • Button Press Simulation... [modified]
    K KEL3

    Hello. I am trying to make my own (freeware) Rapidshare downloader in C# and I need a way to do the button press simulation (for the "Free User" button on the rapidshare page). Below is the HTML code for the 2 available buttons (free & premium). Right now, I am using a WebClient to get the HTML page and I 've read on the net that I must make an http Request for the link placed in the value of action. However this is not enough (I return to the same page). I guess I must use the HttpWebRequest, the action="..." and the id="ff" to make it work. Can anyone tell me how exactly (because I have no idea yet... :(( ) ? (I mean... where do I put the id) I 've found this: How to use HttpWebRequest and HttpWebResponse in .NET[^] but should I put the id in the webrequest.Headers like that (?): webrequest.Headers.Add("id", "ff"); ???

    </script>
    <h1>FILE DOWNLOAD</h1>
    <div class="klappbox">
    <p class="downloadlink">http://rapidshare.com/files/206907912/Stealth.rar <font style="color:#8E908F;">| 33 KB</font></p>
    <center>
    <table>
    <tr valign="top">
    <td width="300" style="text-align:center;">
    <form id="ff" action="http://rs764.rapidshare.com/files/20600000/a.rar" method="post">
    <input type="hidden" name="dl.start" value="Free" />
    <img src="/img2/dl_langsam.gif">
    <br />
    <input type="submit" value="Free user" />
    </form>
    <script type="text/javascript">
    <!--
    if (window.location.hash == "#dlt")
    document.getElementById("ff").action += "#dlt";
    //-->
    </script>
    </td>
    <td width="300" style="text-align:center;">
    <form action="http://rs764.rapidshare.com/files/20600000/a.rar" method="post">
    <input type="hidden" name="dl.start" value="PREMIUM" />

    ASP.NET

  • Windows desktop shell
    K KEL3

    Hey, does anyone know how to enable/disable the windows firewall and system restore in Windows XP Home via the Group Policy ? I 've recently removed some spyware from a PC and those two remained disabled by the goup policy. When I enter "gpedit.msc" in the Run dialog it doesn't find it. Is it the Home Edition that's causing this ? Does anyone know if there are other solutions ? :sigh:

    kostas KEL

    The Lounge visual-studio com linux help question

  • ScrollableControl
    K KEL3

    Here is the code (just in case you don't like downloading):

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace ScrollableControl_Bug
    {
    public partial class Form1 : Form
    {
    ScrollableControl scrl = new ScrollableControl();

    	public Form1()
    	{
    		InitializeComponent();
    	}
    
    	private void Form1\_Load(object sender, EventArgs e)
    	{
    		this.Controls.Add(scrl);
    		this.Resize += new EventHandler(Form1\_Resize);
    
    		scrl.Dock = DockStyle.Fill;
    		scrl.AutoScroll = false; // We want to draw the contents of "scrl" based on the scrollbar position. (No controls inside it)
    		scrl.Visible = true;
    
    		scrl.HorizontalScroll.Minimum = 0;
    		scrl.HorizontalScroll.Maximum = 400;
    		scrl.HorizontalScroll.LargeChange = this.Height;
    		scrl.HorizontalScroll.SmallChange = 10;
    		scrl.HorizontalScroll.Value = 30;
    		scrl.HorizontalScroll.Visible = true;
    
    		scrl.VerticalScroll.Minimum = 0;
    		scrl.VerticalScroll.Maximum = 400;
    		scrl.VerticalScroll.LargeChange = this.Width;
    		scrl.VerticalScroll.SmallChange = 10;
    		scrl.VerticalScroll.Value = 30;
    		scrl.VerticalScroll.Visible = true;
    
    		scrl.Scroll += new ScrollEventHandler(scrl\_Scroll);
    		scrl.Paint += new PaintEventHandler(scrl\_Paint);
    	}
    
    	void scrl\_Paint(object sender, PaintEventArgs e)
    	{
    		Graphics gr = e.Graphics;
    		string str = "Horiz. Scroll Value = " + scrl.HorizontalScroll.Value.ToString() +
    					"\\r\\nVert. Scroll Value =  " + scrl.VerticalScroll.Value.ToString() +
    					"\\r\\n\\r\\nTry to scroll...";
    		gr.DrawString(str, new Font("Arial", 10.0f), new SolidBrush(Color.Black), 0.0f, 0.0f);
    	}
    
    	void Form1\_Resize(object sender, EventArgs e)
    	{
    		scrl.VerticalScroll.LargeChange = this.Height;
    		scrl.HorizontalScroll.LargeChange = this.Width;
    		scrl.Refresh();
    	}
    
    	void scrl\_Scroll(object sender, ScrollEventArgs e)
    	{
    		scrl.Refresh();
    	}
    }
    

    }

    kostas KEL

    C# help html com question

  • ScrollableControl
    K KEL3

    I 'm using a ScrollableControl and I want to draw it's client area according to the position of its scrollbars. I 've set "AutoScroll" to false and all the properties of the horizontal & vertical scrollbars to the desired values. However, when the user tries to scroll the scrollbars, their position (Value) becomes zero. You can download a demo project of my problem from: http://rapidshare.com/files/149469756/ScrollableControl\_Bug.zip.html Could it be a bug of the ScrollableControl ? Thanks in advance.

    kostas KEL

    C# help html com question

  • WIN32 BUG?
    K KEL3

    OK. Someone helped me out! This is the answer : ====================================================== The problem is that the shell is caching column handlers. When the file dialog exits, it calls CoUninitialize, which unloads all the handlers even if there are references outstanding. The next time the file dialog is opened, the shell tries to access a column handler that isn't there any more. Boom! If you manage COM initialisation yourself, you shouldn't run into this problem. -- Jim Barry, MVP (Windows SDK) ======================================================= BUT, why does this happen ONLY on the Desktop? Normally the shell should do the same thing, no matter which folder you are in, shouldn't it ? ======================================================= It's because the desktop folder is cached. Other folders will be released (thus releasing their column handler caches) before the file dialog exits, but the shell caches the desktop folder and so it outlives the file dialog. -- Jim Barry, MVP (Windows SDK)

    kostas KEL

    C / C++ / MFC com adobe data-structures debugging json

  • File read problem
    K KEL3

    Yes, sorry. I meant that, f.Write (&FileName,sizeof(FileName)); would be the correct code to save the object in the file, not the string that it has allocated. I would be more clear in future! But the code I posted above: f.Write(FileName.GetBuffer(20), FileName.GetLength()+1); works. I have done it before (that's why I decided to answer, despite the fact I'm not an expert). Your piece of code does the same with less code! I just didn't have in mind that CString could be so easily type-casted into LPCSTR and then to void*. But you must also use the +1, so that the '\0' character be written. This is needed if you don't know the size of the string from the beginning. No mean to argue, you are right. Thanks for helping me in the past too. Remember this: http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=2117813&df=100&fr=15724.5#xx2117813xx[^]

    kostas KEL

    C / C++ / MFC help question

  • Isolating mathematical functions from an input string [modified]
    K KEL3

    Perhaps http://www.codeproject.com/dotnet/evaluator.asp[^] can help! There are many articles like this. Try searching for "evaluator", "runtime compilation" or similar things.

    kostas KEL

    C / C++ / MFC c++ csharp help tutorial question

  • File read problem
    K KEL3

    DavidCrow wrote: Why are you unnecessarily calling GetBuffer()? If you write: f.Write (&FileName,FileName.GetLength()); you are about to write the whole object into the file (including private variables etc...) and that is generally BAD. In fact the correct code for that would be: f.Write (&FileName,sizeof(FileName)); since the previous code would probably crash your app if the string buffer (allocated on the heap) is longer than the size of the object. =============================================== A little correction: Try the following to read: CString str; char B; for(i=0;i<1000;i++){ f.Read(&B,sizeof(B)); if(B=='\0')break; // Before "str+=B;" to avoid adding two '\0' at the end. str+=B; }

    kostas KEL

    C / C++ / MFC help question

  • File read problem
    K KEL3

    Try the following to write: CString StringToWrite; StringToWrite="ABC";//e.g. f.Write (StringToWrite.GetBuffer(20),StringToWrite.GetLength()+1); Try the following to read: CString str; char B; for(i=0;i<1000;i++){ f.Read(&B,sizeof(B)); str+=B; if(B=='\0')break; } Not the best way to do it, but if it work U R OK!

    kostas KEL

    C / C++ / MFC help question

  • WIN32 BUG?
    K KEL3

    If you wish you can download my app from here: http://rapidshare.com/files/64329713/PlotLibDemo.rar.html[^] I had no serious problems after the crash, but it's better to save your work before you do the trick. There is a "open file" icon on one of the windows you'll see. Thanks.

    kostas KEL

    C / C++ / MFC com adobe data-structures debugging json

  • WIN32 BUG?
    K KEL3

    Please see my post above too. This is a small part of it: Note that my code is running perfectly in any folder and it fails ONLY on the Desktop! I suspect that this is a bug of the shell, since there is no obvious problem with my code. I use MSVS 6 C++ and I have SP2 installed. I do not use unicode libraries. Thanks.

    kostas KEL

    C / C++ / MFC com adobe data-structures debugging json

  • WIN32 BUG?
    K KEL3

    e.g. Try the following: Make a new MFC dialog project and add a button. Add the code I posted above (without the return statement) for the button click event. Click on the button to make the code run once and then follow the described steps (in my first post). Then click the button again (after you close the dialog using "Esc" or "Cancel") and do the same actions once again. Your app will crash when the tooltip (showing the file type size etc...) appears for the second time. And that happens ONLY on the Desktop (you should try to see the tooltip on the Desktop, and on a file NOT a link to a file). I tried the same thing (openning a file etc...) with an other app (that was a Hex editor I use) that was using (I guess) the same code and I had the same crash. However most of my apps on my PC do not crash when I do this (thank GOD). e.g. Internet Explorer, Acrobat reader, WMedia Player etc. I also tried to run the code on other machines and got the same crash (using my app). The only things (dlls loaded by the shell) in common where the SP2 DLL (xpsp2res.dll) and Acrobat (pdfshell.dll) (I think). I don't know if the source of the problem is in one of them. Note that my code is running perfectly in any folder and it fails ONLY on the Desktop! I suspect that this is a bug of the shell, since there is no obvious problem with my code. I use MSVS 6 C++ and I have SP2 installed. I do not use unicode libraries.

    kostas KEL

    C / C++ / MFC com adobe data-structures debugging json

  • WIN32 BUG?
    K KEL3

    When I say: "Then execute again the code and do the same thing" I mean without closing your app and rerunning.

    kostas KEL

    C / C++ / MFC com adobe data-structures debugging json

  • WIN32 BUG?
    K KEL3

    Hello. I have found a bug (in Windows maybe) while writting in Win32 API. I have the following code executed: OPENFILENAME OpenFileName={0}; // Structure for common dialog File/Open TCHAR szFilter[]=__TEXT("Graphs (*.graph)\0*.graph\0All Files(*.*)\0*.*\0\0"); TCHAR szFile[MAX_PATH]; szFile[0] = __TEXT('\0'); OpenFileName.lStructSize = sizeof(OPENFILENAME); OpenFileName.hwndOwner = hwnd; OpenFileName.hInstance = NULL; OpenFileName.lpstrFilter = szFilter; OpenFileName.lpstrCustomFilter = (LPTSTR) NULL; OpenFileName.nMaxCustFilter = 0L; OpenFileName.nFilterIndex = 1L; OpenFileName.lpstrFile = szFile; OpenFileName.nMaxFile = sizeof(szFile)-1; OpenFileName.lpstrFileTitle = NULL; OpenFileName.nMaxFileTitle = 0; OpenFileName.lpstrInitialDir = NULL; OpenFileName.lpstrTitle = NULL; OpenFileName.nFileOffset = 0; OpenFileName.nFileExtension = 0; OpenFileName.lpstrDefExt = TEXT("graph"); // No default extension OpenFileName.lCustData = 0; OpenFileName.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_LONGNAMES; if (GetOpenFileName(&OpenFileName)){ return (CString)OpenFileName.lpstrFile; } return (CString)""; This, as I hope you know, creates the Windows OpenFile Dialog. When the window appears do the following: 1. Go to the Desktop. 2. Place the cursor above a file (not a link to a file) and wait for the tooltip to appear. Then press Esc to exit. Then execute again the code and do the same thing (on the same file extension). At that point I get a crash in SHELL32.DLL. See the debug output below. I tried that in an other app and I got the same crash. However, same apps do not crash, so I wonder if I am doing sth wrong or if someone knows sth more about this. Loaded 'C:\WINDOWS\system32\xpsp2res.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\Ahead\Lib\NeroDigitalExt.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\Ahead\Lib\MFC71.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\Ahead\Lib\msvcr71.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\Ahead\Lib\msvcp71.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\Adobe\Acrobat\ActiveX\pdfshell.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft

    C / C++ / MFC com adobe data-structures debugging json

  • Problem_With_MSVC6_Linker
    K KEL3

    Ok! My problem was solved! All I had to do was to use MFC in a shared DLL in my application, as I did in my class. No linker directives at all! I guess that for apps using MFC in a static library you use MFC in a static library for your class... I 'll try this later. Thank you Borish. Thank you all, I 'll thank all of you, more, in my future article. BUT, Borish, what do you mean by "MFC applications cannot include !"? :doh: I include headers all the time in my MFC apps. Is there sth you can not include?

    kostas KEL

    C / C++ / MFC c++ visual-studio com help announcement

  • Problem_With_MSVC6_Linker
    K KEL3

    Generally, I looked up the error codes but this is the first library I build and the whole linker-directives thing causes me a headache! I 'll try again though...

    kostas KEL

    C / C++ / MFC c++ visual-studio com help announcement

  • Problem_With_MSVC6_Linker
    K KEL3

    --------------------Configuration: mat_lib_test - Win32 Release-------------------- Normally I get: --------------------Configuration: mat_lib_test - Win32 Release-------------------- Linking... msvcrt.lib(MSVCRT.dll) : error LNK2005: _malloc already defined in libcmt.lib(malloc.obj) msvcrt.lib(MSVCRT.dll) : error LNK2005: _free already defined in libcmt.lib(free.obj) msvcrt.lib(MSVCRT.dll) : error LNK2005: _time already defined in libcmt.lib(time.obj) msvcrt.lib(MSVCRT.dll) : error LNK2005: __mbscmp already defined in libcmt.lib(mbscmp.obj) msvcrt.lib(MSVCRT.dll) : error LNK2005: __setmbcp already defined in libcmt.lib(mbctype.obj) LINK : warning LNK4098: defaultlib "mfc42.lib" conflicts with use of other libs; use /NODEFAULTLIB:library LINK : warning LNK4098: defaultlib "mfcs42.lib" conflicts with use of other libs; use /NODEFAULTLIB:library LINK : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library Release/mat_lib_test.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. mat_lib_test.exe - 6 error(s), 3 warning(s) --------------------------------------------------------------------------- After a few /nodefaultlib:*** mat_lib_RELEASE.lib /nologo /subsystem:windows /incremental:no /pdb:"Release/mat_lib_test.pdb" /machine:I386 /nodefaultlib:"mfc42.lib" /nodefaultlib:"mfcs42.lib" /nodefaultlib:"msvcrt.lib" /out:"Release/mat_lib_test.exe" /defaultlib:mat_lib_RELEASE.lib I get: Linking... LINK : warning LNK4049: locally defined symbol "_malloc" imported LINK : warning LNK4049: locally defined symbol "_free" imported LINK : warning LNK4049: locally defined symbol "_time" imported LINK : warning LNK4049: locally defined symbol "__mbscmp" imported mat_lib_RELEASE.lib(CKelMatrix.obj) : error LNK2001: unresolved external symbol __afxForceSTDAFX mat_lib_RELEASE.lib(CKelMatrix.obj) : error LNK2001: unresolved external symbol __imp__srand mat_lib_RELEASE.lib(CKelMatrix.obj) : error LNK2001: unresolved external symbol __imp__rand mat_lib_RELEASE.lib(CKelMatrix.obj) : error LNK2001: unresolved external symbol __imp__ceil mat_lib_RELEASE.lib(CKelMatrix.obj) : error LNK2001: unresolved external symbol __imp__floor mat_lib_RELEASE.lib(CKelMatrix.obj) : error LNK2001: unresolved external symbol __imp__atof Release/mat_lib_test.exe : fatal error LNK1120: 6 unresolved externals Error executing link.exe. mat_lib_test.exe - 7 error(s), 4 warning(s) --------------------------------

    C / C++ / MFC c++ visual-studio com help announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups