I am working on MFC project based on VCSamples in Github. This project similar "Windows Explorer.exe" (Under picture).
I know that select button of "Large Icons" ,"Small Icons" "Details" and "List" is can change file list view. But I want large size of Thumbnails for Image file like windows real explorer.exe (Under picture)
I searched for information about "CMFCShellListCtrl", but there was no information or only information on "CMFCShellTreeCtrl". ("CMFCShellListCtrl" is in 'ExplorerView.h/.cpp' in VCSamples project)
Did I misunderstand? Or Should I customize "CMFCShellListCtrl"?
Related
I'm currently developing a game with SDL2 in C++ and I want to set my game's icon for the task bar and for the Alt-Tab switcher. I am trying to achieve this by using SDL_SetWindowIcon():
SDL_Surface* icon = IMG_Load("icon.png");
SDL_SetWindowIcon(sdlWindow, icon);
Even if my window is correctly initialized and the surface is loaded, the icon does not appear in the task bar or in the Alt-Tab switcher. I am on Ubuntu 16.04 LTS.
Does anyone know what I'm doing wrong?
I'm not going to claim that I understand how this function works, but I can share with you how I got it to work. Even though I could use a 600x600 (pixels) image in the desktop.my_app file, and using that launcher would work fine, SDL2 would NOT load a 600x600 image. I tried 128x128 too, and that didn't work.
Changing the image size to 64x64 miraculously fixed it. Storage issue? I don't know why SDL2 can handle huge SDL_Surface s in other parts of the app but not the window icon....
Rather then taking this tough path, if you set Icon through the IDE it will appear everywhere, I mean everywhere such as File explorer, Taskbar, SDL Window or its(exe) shortcut etc.
follow these steps for Visual Studio
You need to use an .ico file. You cannot use a PNG image file for your executable's icon, it will not work. You must use .ico. There are online converters available for image to .ico files.
I will recommend this https://convertico.com/
because it was multiple icons in single file option which many tools dont provide (this is not a promotion/Ad)
The ico used for your exe will be the ico with the LOWEST RESOURCE ID. In order to change the .ico
Open VIEW > RESOURCE VIEW (in the middle of the VIEW menu), or press Ctrl+Shift+E to get it to appear.
In Resource view, right click the project name and right click "ADD" -> "RESOURCE..."
Single Click on "Icon" then from the list of many items, then click "IMPORT..".
When a file selection will open *.ico files aren't listed, and you can't use a regular PNG or JPG image as an icon, so change the file filter to *.ico using the dropdown.
Now you are done. you can see the icon available everywhere
If you load a bunch of ICO files into the project for whatever reason, be sure the .ico you want Visual Studio to use has the lowest id in resource.h. You can edit this file manually with no problems
Eg.
//resource.h
#define IDI_ICON1 102
#define IDI_ICON2 103
IDI_ICON1 is used
//resource.h
#define IDI_ICON1 106
#define IDI_ICON2 103
Now IDI_ICON2 is used.
I am new to changing default icons on c++ console applications. But recently, I have been wanting to know how it is accomplished. I managed to save an .ico file and when I build my application in Release mode I open it and I see the new image show up when my window is running and then a tiny icon showing up in the top left hand of the screen, and seeing that made me very happy.
But I wanted to know how can I change the image of my executable file so that it is consistent with my program?
From this...
To this...
Can anyone help me figure out what the steps are to change the default executable icon to the one I want? Many thanks in advanced!
Add a new file to the existing projekt and select as file type
"Symbol (ico)" in the "Resource" category.
Draw it, save it, compile again, finished.
Windows will automatically display the icon with the lowest ID (if any).
If there is only one icon, it can be only that one...
edit: You should make different sizes (16x16, 32x32, 64x64 etc.).
I have a MFC-application that uses the Acrobat OCX to display a PDF inside a CView.
When the PDF contains a link, the control changes the mouse cursor when hovering over it, but when I click it nothing happens.
When I use the Acrobat Reader application, it asks me if I want to open the link. So I guess there is some kind of notification message emitting from the control. It would be ok if I just get the address of the link, then I could open it myself.
Active X's link only works to the named destinations inside the same PDF file.
Developing Applications Using Interapplication Communication
You can also treat a PDF document as an ActiveX® document and implement convenient PDF browser controls through the AcroPDF object. This object provides you with the ability to load a file, move to various pages within a file, and specify various display and print options. A detailed description of its usage is provided in “Summary of OLE objects and methods” on page 30.
You probably have to use another OLE autoimation method, such as rendering PDF documents.
Developing Applications Using Interapplication Communication - on OLE capabilities in Acrobat section
You can render PDF documents on the screen in two ways:
●Use an interface similar to the Acrobat user interface.
In this approach, use the AVDoc object’s OpenInWindowEx method to open a PDF file in your application’s window. The window has vertical and horizontal scroll bars, and has buttons on the window’s perimeter for setting the zoom factor. Users interacting with this type of window find its operation similar to that of working in Acrobat. For example, links are active and the window can display any text annotation on a page.
The ActiveView sample in the Guide to SDK Samples shows how you can use this approach.
However, before you start this method, I recommend to download Acrobat SDK and excute some sample program whether link event is occured normally. Acrobat SDK have many useful vc++, c# sample program.
I am working on visual++ and trying to render a preview of a html file on a dialog box/Window created by me.
(just as we get preview pane on window explorer on hmlFile.html single click) .
I tried lot of search on google but resulted in un-success.
I got idea from somewhere that it can be accomplished by using activex control.
My project is already rendering FileName.png image(i mean already working for .png image) in the dialog box i created.
But now the next task is to make the preview render for .html files. I have no ideas of how to accomplish this task . any ideas ?? If by ActiveX Control ??
For ;png file the idea was to store the contents of .png file in the stream(which is generated by single button click on .png file) and then create decoder and then create bitmap source to 32bppHbitmap and then preview on preview pane/window created/dialog Box and i also know about .xml files -in this case we create a style sheet) but i dont' know how to do for html files ???
Any help ?? or good links ????
The MFC library makes this rather easy. Here is a link to a sample program that uses MFC CHtmlView to create a browser:
http://msdn.microsoft.com/en-us/library/ms177540(v=VS.80).aspx
I was wondering if there was a way to change the default icon that VS2012 makes when I compile my app. Just for those wondering, I am trying to change the .exe program's icon, not the window icon at the top left of the window and on the start menu. I already know how to do that. I have been Google-ing this for ever and it always shows up how to change the window icon, not the actual file's icon. Thanks in advance!!!
EDIT: This is what I want to do...
I want to replace this...
with this...
]
Thanks, hope this clarifies.
Adding icon to executable
Tested for VS2012 Express
Create a icon.rc file next to your .vcxproj file and fill it with the following text:
// Icon Resource Definition
#define MAIN_ICON 102
MAIN_ICON ICON "your_icon.ico"
Then add the following to your .vcxproj file anywhere within the Project tag:
<ItemGroup>
<ResourceCompile Include="icon.rc">
</ResourceCompile>
</ItemGroup>
Additional options
If you want you may forward definitions to your icon.rc file like so:
<ItemGroup>
<ResourceCompile Include="icon.rc">
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/D_DEBUG %(AdditionalOptions)</AdditionalOptions>
</ResourceCompile>
</ItemGroup>
Notice the /D_DEBUG definition, which defines _DEBUG for your resource file. Then within your icon.rc file check for definitions normally:
#define MAIN_ICON 102
#if defined(_DEBUG)
MAIN_ICON ICON "debug_icon.ico"
#else
MAIN_ICON ICON "release_icon.ico"
#endif
Add an icon in the resource section of you C++ project. This icon will be shown as an Application icon for your executable. [Note: make sure you are in the Resource View window, not the Solution Explorer window. Then right-click on the rc folder to Add Resource...]
I have tried this with Win32 Console Application and it shows the icon in the Explorer as Application Icon. This should work with other types of applications also.
Also note that while adding the icon you need to add different size images for the Icon like 16*16, 32*32. These different icon images will be used by Windows Explorer to display Application Icon in different View Modes(Small Icons, Medium Icons, Larget Icons, Extra Large icons etc.)
This is not really how it works. The size of the icon of your program as displayed by Windows isn't determined by you, the user selects it. It is a user preference, very simple to change on later Windows versions by just rolling the mouse scroll button on the desktop. And an icon doesn't have just a single size, it is capable of storing multiple images. Windows picks the one that fits best. And the one you get when starting a new project is just a stock one that's stored in the project template. You can change it by tinkering with the project template .zip file but that's kinda pointless, you want to give your program a custom icon that personalizes it.
Best thing to do is to steal, beg or borrow one, making a good looking icon is an art. Lots of web sites where you can download free ones. If you want to take a shot at creating your own then that's supported as well. Simply double-click the project's .rc file to open the resource view, open the Icon node and double-click the default icon to open the icon editor. You add a new size with Image + New Image Type. Plenty of freeware icon editors available as well.
If its a Win32 application then you can add a resource to your project and then put the icon in there. Then you can assign the icon to your application by sending the WM_SETICON method. For MFC applications, resources are already present and there is a nominated icon resource that you can just change.
You can also load it directly from an external file as suggested here:
Setting program icon without resources using the WIN32 API
I would recommend the resource route though. Resources get embedded in your executable and it is the recommended way to do this sort of thing in Win32 and MFC.