Quantcast
Channel: Visual C forum
Viewing all 15302 articles
Browse latest View live

Identifier 'GetFontResourceInfoW' is undefined

$
0
0

I'm fairly new to Windows programming. But I have a need to mess around with external font files and I've encountered several sources that recommend using the undocumented function GetFontResourceInfoW to get font names from external font files. The problem is, I can't find that definition in any of the installed headers. I'm using Visual Studio 2017 and Windows SDK 10.0.17134.0.

I'm also new to PowerShell, so please bear with me if I did something wrong here. But I used this command to search header files for the definition:

PS C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0> Get-ChildItem -Recurse -Filter *.h | Select-String -Pattern AddFontRes | group path | select name


CDialog ScrollBar

$
0
0

Hi,

In my MFC dialog application I am using CMFCTabCtrl.

I am having a dialog in one of the tab page. In that dialog I am displaying multiple child dialogs dynamically.The contents of dialog exceeds the dialog's client area. The dialog which has tab control is resizable dialog.

Now I added scroll bar to the dialog of tab page.

Now my problem is after scrolling to some position If I resize the dialog or maximize or minimize the dialog, the client are is not getting scrolled up to top.

The mousewheel and scrolling bar operation are working fine.

Below is my code 

void CMyDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
	// TODO: Add your message handler code here and/or call default.
  	int nDelta;
  	int nMaxPos = m_rect.Height() - m_nCurHeight;

  	switch (nSBCode)
  	{
  	case SB_LINEDOWN:
  		if (m_nScrollPos >= nMaxPos)
  			return;
  		nDelta = min(nMaxPos/20,nMaxPos-m_nScrollPos);
  		break;

  	case SB_LINEUP:
  		if (m_nScrollPos <= 0)
  			return;
  		nDelta = -min(nMaxPos/20,m_nScrollPos);
  		break;

           case SB_PAGEDOWN:
  		if (m_nScrollPos >= nMaxPos)
  			return;
  		nDelta = min(nMaxPos/10,nMaxPos-m_nScrollPos);
  		break;

  	case SB_THUMB  		nDelta = (int)nPos - m_nScrollPos;
  		break;

  	case SB_PAGEUP:
  		if (m_nScrollPos <= 0)
  			return;
  		nDelta = -min(nMaxPos/10,m_nScrollPos);
  		break;
           default:
  		return;
  	}
  	m_nScrollPos += nDelta;
  	SetScrollPos(SB_VERT,m_nScrollPos,TRUE);
  	ScrollWindow(0,-nDelta);
  	CDialog::OnVScroll(nSBCode, nPos, pScrollBar);

}
void CMyDlg::OnSize(UINT nType, int cx, int cy) 
  {
  	CDialog::OnSize(nType, cx, cy);
  	m_nCurHeight = cy;
  	SCROLLINFO si;
  	si.cbSize = sizeof(SCROLLINFO);
  	si.fMask = SIF_ALL; // SIF_ALL = SIF_PAGE | SIF_RANGE | SIF_POS;
  	si.nMin = 0;
	si.nMax = m_rect.Height();
	si.nPage = cy;
  	si.nPos = 0;
        SetScrollInfo(SB_VERT, &si, TRUE);
	Invalidate(TRUE);
  }
BOOL CMyDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
	int nMaxPos = m_rect.Height() - m_nCurHeight;
	if (zDelta<0)
	{
		if (m_nScrollPos < nMaxPos)
		{
			zDelta = min(max(nMaxPos/20,5),nMaxPos-m_nScrollPos);

			m_nScrollPos += zDelta;
			SetScrollPos(SB_VERT,m_nScrollPos,TRUE);
			ScrollWindow(0,-zDelta);
		}
	}
	else
	{
		if (m_nScrollPos > 0)
		{
			zDelta = -min(max(nMaxPos/20,5),m_nScrollPos);

			m_nScrollPos += zDelta;
			SetScrollPos(SB_VERT,m_nScrollPos,TRUE);
			ScrollWindow(0,-zDelta);
		}
	}
	return CDialog::OnMouseWheel(nFlags, zDelta, pt);
}

Here m_rect is sum of size of all the child dialogs which are diaplayed(it means the contents size) not the dialog's client area.

Images

Now I scrolled to some position.

Now I maximized , but the child dialog with text implicit msg1 is missing.

Now I minimized , now also the child dialog with text implicit msg1 is missing in the dialog.


Project won't build in V14.15.26726 due to missing _Debug_message definition in xutility

$
0
0

Hi,

We've just updated to the latest version of Visual Studio 2017 Enterprise (15.8.0) and one of our C++ projects will no longer build. The exact error is:

Error    C2039    '_Debug_message': is not a member of 'std'

Having checked the references on a machine with an earlier version installed (using VC++ 14.14.26428) it appears that this is not defined in the later 14.15.26726 xutility internal header file (C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\include) . In the earlier version it is defined on line 36 of that file as "_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL _Debug_message(const wchar_t *,
    const wchar_t *, unsigned int);" but it is missing from the newer version.

Has this been remapped elsewhere or is this an omission? Comparing the two files shows that there are considerable differences so I doubt they are compatible, it looks like everything has been reworked in this version.

Essentially it looks like the memory header file is no longer compatible with the xutility header yet they are the same version!?

Please can you advise?

Many thanks,

Damien




How to draw transperent bitmap with IPicture::Render

$
0
0

Hi,

I am loading a bitmap  from resource using OleLoadPicture() and drawing using IPicture::Render().

I want to draw transparent bitmap using IPicture . In the picture I want to make white color as transparent.

How to achieve it?

Microsoft.Cpp.Win32.Targets(147,5): error MSB6001: Invalid command line switch for "CL.exe". The value [..\..\..\..\\dummy\dummy\dummy\dummy"] contains an odd number of double-quote characters

$
0
0

Hi,

I’m trying to migrate some projects from Visual studio 2008 to Visual studio 2017.
I’ve installed Visual Studio 2010 and changed the Platform Toolset back to Visual Studio 2008 (v90) which helpedme get rid of most of the errors, but I’ve still got this error:

Severity

Code

Description

Project

File

Line

Suppression State

Error

MSB6001

Invalid command line switch for "CL.exe". The value[..\..\..\..\\dummy\dummy\dummy\dummy"] contains an odd number of double-quote characters. Only even numbers of literal double-quote characters are acceptable to command line tools.

common

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets

147


How can this be resolved? Can I disable the command line tools (i'm only using the IDE GUI) to get rid of this error?

Thanks,

Lior


Question about file with random name without extension

$
0
0
Hi, I'm new here .. Can anyone help me with 1/2 functions? I found a random name file with no extension in TEMP. So I have to find  with C ++ like this: "find TEMP file (without C: \ Users \ AppData \ Local \ Temp) there you will find file witch got 16 random digits and that file is without extension " . So what i know is : 1.that file is somewhere in temp 2. that file dont have extension. 3. that file got 16 random digits. How can i find it?

What is the virtual key value of "+"?

$
0
0

In my project, I adopt shortcut key for some menu items. What I expect is like this:

Zoom In --> Ctrl++

Zoom Out --> Ctrl+-

Restore to Original size --> Ctrl+=

However, when I set accelerators, I found that VK_OEM_PLUS is assigned to "=" sign, and my google result such as this  also confirm this. Then what is the virtual key for "+"?

I tried VK_ADD, however the result will look like this.

Can any one help ?

The IDE is Visual Studio 2015 community.

Thank you so much!


How to create a protected folder in C++(winapi)

$
0
0

hi everybody,

I want to create a folder like Anti Virus's folder that any other process or service can not add, delete or modify any file from it. Pay attention that I'm in service level so I can not use ACLs.

any one have an idea that how antiviruses do that?


In MFC how to display a child dialog if it is bigger than parent dialog?

$
0
0

HI,

In MFC how to display a child dialog if it is bigger than parent dialog?


Unable to add existing folder to project

$
0
0

Hello,

I have a solution with 2 projects:

The project AcsGE_Window has the folder AcsGE (this is a git submodule). The folder somehow appeared on the project (it's in the project root dir)

In the project AcsGE_Rendere I have created the same submodule (AcsGE) but for some reason when I select all the files from that folder I don't get the folder in my project (which is behavior I have seen before)

This is the folder select

This is what I get:

I just want it like it is in the AcsGE_Window project, a folder.

Can anyone please tell me what I am doing wrong?

Microsoft Visual Studio Community 2017
Version 15.8.1
VisualStudio.15.Release/15.8.1+28010.2003
Microsoft .NET Framework
Version 4.7.03056
Installed Version: Community
Visual C++ 2017   00369-60000-00001-AA236
Microsoft Visual C++ 2017


Unable to report a problem from Visual Studio 2017

$
0
0
Hi,

I'm using Visual Studio products as an Cisco employee. I'm licensed to Visual Studio Professional Edition product family with license number  68443398.

All though i'm licensed as mentioned, i still can't report a problem from the Visual Studio 2017 IDE. 
I'm getting the following message:
"Your sign-in was successful but you don't have permission to access this resource".

Regards,

Lior

How to apply split images(.swm) using WimApplyImage() API

$
0
0

There is a msdn code sample on how to apply an image from a single .wim file by using the WIMApplyImage function.But there does not seem to be any code sample for applying the image from split files(.swm) files. Any help regarding on how to apply swm files? 

https://msdn.microsoft.com/en-us/library/windows/desktop/dd851944.aspx

Wall Clock Windows Embedded Compact test failed

$
0
0

I got error when doing wallclock test in cetk.

Error,

PID:03DC0006 TID:03DE0006 Exception 'Data Abort' (0x4): Thread-Id=03de0006(pth=c0452b78), Proc-Id=03dc0006(pprc=c0438aa0) 'tux.exe', VM-active=03dc0006(pprc=c0438aa0) 'tux.exe'

PID:03DC0006 TID:03DE0006 PC=400b61f5(msvcrt.dll+0x000461f5) RA=00000007(???+0x00000007) SP=0003df50, BVA=00007530


Regards,

Vinoth S

Convert table cell format into excel

$
0
0
Programmatically, how do I convert the table cell height and width from another package that creates tables in mm to excel? Also, how do I prevent excel from hiding columns and/or rows? I want to open it up and see my converted table in exactly the same way I saw it in my previous application.

Win10 UI without minimize & maximize buttons

$
0
0

Hey I'm currently trying to create a windows UI which only displays the close button in the title bar.

Is this even possible in windows?

So far it only works without displaying anything or displaying all 3 buttons.


Video Game Developer


IPicture::SelectPicture and TransparentBlt()

$
0
0

Hi,

Can u plz share some code regarding how to use IPicture::SelectPicture()  andTransparentBlt().I have gone through MSDN but not able to figure out this.

Thanks.

In MFC how to draw transparent jpeg?

$
0
0

Hi,

I want to draw transparent jpeg. 

I want to make certain area of the image which is currently white transparent.

Thanks

Destroy Pop-Up window automatically when we click on any other window in MFC

$
0
0

I have my own class(CMyclass) which derives from CDialog. There is a method bn_clikced() in CMyclass, in that method
i have created MessageBox("My message") which creates a warning pop-up.
My requirement is whenever i click my mouse on any other windows the pop-up should go off automatically.

Can you guys provide me sample code in MFC c++

Regards,

i can't build my project

$
0
0

I am trying to build the project on the debugger option but this stays as bugged, it does not get to build the code simply stays in ready

any could help me? it's my first open source too

here the pic

https://i.imgur.com/AVcxSqi.jpg

Changing system time without administrator privileges

$
0
0

I have a c++ program that calls SetLocalTime. There are only 2 ways that I can get it to work and I don't have the option for either one. The first is to run the application as an administrator. The second is to disable the EnableUA registry setting. I have also tried the group policy setting Change the system time by adding the local account that I am running under and adding the users group. This does not fix the problem.

I am running Windows 10 Enterprise 2016 LTSB. Build 10.0.14393.

I have also tried using the command line time command and have the same issue 8:52

Viewing all 15302 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>