|
I need to get a list of all the Bluetooth Devices that the PC is paired with.
We make a Bluetooth device that my code talks to as though it were a COM Port. All the paired devices appear in a list in 'Bluetooth Devices'. At present my user has to pick a com port from a list of 1 to 256. It would be alot better to tell them what device is connected to which COM port and let them pick from that list.
I haven't a clue where to look, and Googling gives me loads of results, almost all of which are at a much less detailed level.
Any ideas anyone?
Ali
|
|
|
|
|
Does anyone know how to communicate with a web server through 2-way SSL (https) from an MFC app using the clients default browsers certificate store? I have to make an app work that uses a variety of browsers (Netscape 7.2, IE, and Mozilla Firefox) certificate stores to communicate with a WebLogic server.
Any help would be greatly appreciated.
Stuart
|
|
|
|
|
how to concatenate strings with longs for example if i want to do that:
long j=5;
MessageBox("the number is"+J+"apples");
|
|
|
|
|
You can use printf for that:
char szBuffer[50];
sprintf(szBuffer,"the number is %i apples",J);
Take a look at sprintf[^] and format spec[^] in the MSDN for more details.
|
|
|
|
|
See CString::Format and wsprintf(...)
|
|
|
|
|
Also you can use CString class as,
CString str("");
LONG l = 5;
str.Format("The Number is %ld Apples", l);
MessageBox(str);
Do your Duty and Don't expect the Result
|
|
|
|
|
I have a SDI program that uses ScroolView. If I put only 25 lines of text everything it's ok but if I put out 250 lines then it won't display it all. I know I can set the scroolsize with SetScrollSizes in the OnInitialUpdate() function. My question is : can I modify that scrool size throughout the program?
|
|
|
|
|
tanarnelinistit wrote: My question is : can I modify that scrool size throughout the program?
Yes of course.
BTW, why didn't you test it ? You just have to add two or three lines of code and you'll get your answer
|
|
|
|
|
By the way: it's 'scroll', not 'scrool'.
Software Zen: delete this;
|
|
|
|
|
I already have a imageList and would like to use images from it as input to the CMenu SetMenuItemBitmaps. But I can only see how to get an HIcon from CImageList and I can't find out how to convert it to a bitmap (or any other way for consumption by CMenu).
Thanks for any help!!
Jeremy
|
|
|
|
|
See Here[^] maybe it is some helpful to you
|
|
|
|
|
Use GetIconInfo(..) API to have HBITMAP from HICON...
ICONINFO IconInfo;
GetIconInfo(hIcon, &IconInfo);
then use IconInfo.hbmColor for HBITMAP...
i.e., HBITMAP hBitmap = IconInfo.hbmColor;
Make sure to delete those bitmap handles as..
DeleteObject(IconInfo.hbmColor);
DeleteObject(IconInfo.hbmMask);
-- modified at 0:37 Friday 28th July, 2006
Do your Duty and Don't expect the Result
|
|
|
|
|
can anyone please help me - i cannot for the life of me implement a keyboard to this code - if ANYONE can help put some into the folowing to allow simple control of movement of the cube i WOULD BE VERY APPRECIATIVE. PLEASE HELP, have worked for days on this and cannot work it out.
#include <windows.h>
#include <mmsystem.h>
#include <d3dx9.h>
#pragma warning( disable : 4996 ) // disable deprecated warning
#include <strsafe.h>
#pragma warning( default : 4996 )
// Define M_PI in case the compiler does not
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif
// Macro to convert radians to degrees
#define RAD_2_DEG(x) ((x) * 180 / M_PI)
#define DEG_2_RAD(x) ((x) * M_PI / 180)
//-----------------------------------------------------------------------------
// Global variables
//-----------------------------------------------------------------------------
LPDIRECT3D9 g_pD3D = NULL; // Used to create the D3DDevice
LPDIRECT3DDEVICE9 g_pd3dDevice = NULL; // Our rendering device
LPDIRECT3DVERTEXBUFFER9 g_pVB = NULL; // Buffer to hold vertices
//IDirect3DDevice9 g_device = NULL;
// A structure for our custom vertex type
struct CUSTOMVERTEX
{
FLOAT x, y, z; // The untransformed, 3D position for the vertex
DWORD color; // The vertex color
};
// Our custom FVF, which describes our custom vertex structure
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_DIFFUSE)
//-----------------------------------------------------------------------------
// Name: InitD3D()
// Desc: Initializes Direct3D
//-----------------------------------------------------------------------------
HRESULT InitD3D( HWND hWnd )
{
// Create the D3D object.
if( NULL == ( g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
return E_FAIL;
// Set up the structure used to create the D3DDevice
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
// Create the D3DDevice
if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &g_pd3dDevice ) ) )
{
return E_FAIL;
}
// Turn off culling, so we see the front and back of the triangle
g_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
// Turn off D3D lighting, since we are providing our own vertex colors
g_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: InitGeometry()
// Desc: Creates the scene geometry
//-----------------------------------------------------------------------------
HRESULT InitGeometry()
{
// Initialize three vertices for rendering a triangle
CUSTOMVERTEX g_Vertices[] =
{
//Top Face
{-5.0f, 5.0f, -5.0f, D3DCOLOR_XRGB(0, 0, 255),}, //Vertex 0 - Blue
{-5.0f, 5.0f, 5.0f, D3DCOLOR_XRGB(255,255,255),}, //Vertex 1 - Red
{5.0f, 5.0f, -5.0f, D3DCOLOR_XRGB(255,255,255),}, //Vertex 2 - Red
{5.0f, 5.0f, 5.0f, D3DCOLOR_XRGB(0, 255, 0),}, //Vertex 3 - Green
//Face 1
{-5.0f, -5.0f, -5.0f, D3DCOLOR_XRGB(255,255,255),}, //Vertex 4 - Red
{-5.0f, 5.0f, -5.0f, D3DCOLOR_XRGB(0, 0, 255),}, //Vertex 5 - Blue
{5.0f, -5.0f, -5.0f, D3DCOLOR_XRGB(0, 255, 0),}, //Vertex 6 - Green
{5.0f, 5.0f, -5.0f, D3DCOLOR_XRGB(255,255,255),}, //Vertex 7 - Red
//Face 2
{5.0f, -5.0f, 5.0f, D3DCOLOR_XRGB(0, 0, 255),}, //Vertex 8 - Blue
{5.0f, 5.0f, 5.0f, D3DCOLOR_XRGB(0, 255, 0),}, //Vertex 9 - Green
//Face 3
{-5.0f, -5.0f, 5.0f, D3DCOLOR_XRGB(0, 255, 0),}, //Vertex 10 - Green
{-5.0f, 5.0f, 5.0f, D3DCOLOR_XRGB(255,255,255),}, //Vertex 11 - Red
//Face 4
{-5.0f, -5.0f, -5.0f, D3DCOLOR_XRGB(255,255,255),}, //Vertex 12 - Red
{-5.0f, 5.0f, -5.0f, D3DCOLOR_XRGB(0, 0, 255),}, //Vertex 13 - Blue
//Bottom Face
{5.0f, -5.0f, -5.0f, D3DCOLOR_XRGB(0, 255, 0),}, //Vertex 14 - Green
{5.0f, -5.0f, 5.0f, D3DCOLOR_XRGB(0, 0, 255),}, //Vertex 15 - Blue
{-5.0f, -5.0f, -5.0f, D3DCOLOR_XRGB(255,255,255),}, //Vertex 16 - Red
{-5.0f, -5.0f, 5.0f, D3DCOLOR_XRGB(0, 255, 0),}, //Vertex 17 - Green
};
// Create the vertex buffer.
if( FAILED( g_pd3dDevice->CreateVertexBuffer( 38*sizeof(CUSTOMVERTEX),
0, D3DFVF_CUSTOMVERTEX,
D3DPOOL_DEFAULT, &g_pVB, NULL ) ) )
{
return E_FAIL;
}
// Fill the vertex buffer.
VOID* pVertices;
if( FAILED( g_pVB->Lock( 0, sizeof(g_Vertices), (void**)&pVertices, 0 ) ) )
return E_FAIL;
memcpy( pVertices, g_Vertices, sizeof(g_Vertices) );
g_pVB->Unlock();
return S_OK;
}
//-----------------------------------------------------------------------------
// Name: Cleanup()
// Desc: Releases all previously initialized objects
//-----------------------------------------------------------------------------
VOID Cleanup()
{
if( g_pVB != NULL )
g_pVB->Release();
if( g_pd3dDevice != NULL )
g_pd3dDevice->Release();
if( g_pD3D != NULL )
g_pD3D->Release();
}
//-----------------------------------------------------------------------------
// Name: SetupMatrices()
// Desc: Sets up the world, view, and projection transform Matrices.
//-----------------------------------------------------------------------------
VOID SetupMatrices()
{
// For our world matrix, we will just rotate the object about the y-axis.
D3DXMATRIXA16 matWorld;
// Set up the rotation matrix to generate 1 full rotation (2*PI radians)
// every 1000 ms. To avoid the loss of precision inherent in very high
// floating point numbers, the system time is modulated by the rotation
// period before conversion to a radian angle.
UINT iTime = timeGetTime() % 10000;
FLOAT fAngle = iTime * (2.0f * D3DX_PI) / 10000.0f;
D3DXMatrixRotationY( &matWorld, fAngle );
g_pd3dDevice->SetTransform( D3DTS_WORLD, &matWorld );
// Set up our view matrix. A view matrix can be defined given an eye point,
// a point to lookat, and a direction for which way is up. Here, we set the
// eye five units back along the z-axis and up three units, look at the
// origin, and define "up" to be in the y-direction.
D3DXVECTOR3 vEyePt( 0.0f, 40.0f,-40.0f );
D3DXVECTOR3 vLookatPt( 0.0f, 0.0f, 0.0f );
D3DXVECTOR3 vUpVec( 0.0f, 1.0f, 0.0f );
D3DXMATRIXA16 matView;
D3DXMatrixLookAtLH( &matView, &vEyePt, &vLookatPt, &vUpVec );
g_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );
// For the projection matrix, we set up a perspective transform (which
// transforms geometry from 3D view space to 2D viewport space, with
// a perspective divide making objects smaller in the distance). To build
// a perpsective transform, we need the field of view (1/4 pi is common),
// the aspect ratio, and the near and far clipping planes (which define at
// what distances geometry should be no longer be rendered).
D3DXMATRIXA16 matProj;
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 500.0f );
g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
}
//-----------------------------------------------------------------------------
// Name: Render()
// Desc: Draws the scene
//-----------------------------------------------------------------------------
VOID Render()
{
// Clear the backbuffer to a black color
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
// Begin the scene
if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
{
// Setup the world, view, and projection Matrices
SetupMatrices();
// Render the vertex buffer contents
g_pd3dDevice->SetStreamSource( 0, g_pVB, 0, sizeof(CUSTOMVERTEX) );
g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
//g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 3, 3);
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 4, 8 );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 12, 2 );
/*
D3DXMatrixTranslation( &mTrans, 2.0f, 0.0f, 0 );
g_pd3dDevice->SetTransform( D3DTS_WORLD, &mTrans );
g_pd3dDevice->SetStreamSource( 0, g_pTriangleList_VB, 0, sizeof(Vertex) );
g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2 );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 4, 8 );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 12, 2 );
*/
// End the scene
g_pd3dDevice->EndScene();
}
// Present the backbuffer contents to the display
g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
//-----------------------------------------------------------------------------
// Name: MsgProc()
// Desc: The window's message handler
//-----------------------------------------------------------------------------
LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch( msg )
{
case WM_DESTROY:
Cleanup();
PostQuitMessage( 0 );
return 0;
}
return DefWindowProc( hWnd, msg, wParam, lParam );
}
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: The application's entry point
//-----------------------------------------------------------------------------
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
{
// Register the window class
WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
"D3D Tutorial", NULL };
RegisterClassEx( &wc );
// Create the application's window
HWND hWnd = CreateWindow( "D3D Tutorial", "D3D Tutorial 03: Matrices",
WS_OVERLAPPEDWINDOW, 100, 100, 256, 256,
NULL, NULL, wc.hInstance, NULL );
// Initialize Direct3D
if( SUCCEEDED( InitD3D( hWnd ) ) )
{
// Create the scene geometry
if( SUCCEEDED( InitGeometry() ) )
{
// Show the window
ShowWindow( hWnd, SW_SHOWDEFAULT );
UpdateWindow( hWnd );
// Enter the message loop
MSG msg;
ZeroMemory( &msg, sizeof(msg) );
while( msg.message!=WM_QUIT )
{
if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
Render();
}
}
}
UnregisterClass( "D3D Tutorial", wc.hInstance );
return 0;
}
wickedsue
|
|
|
|
|
First of all, posting your entire application and asking someone to finish it for you isn't going to work. We're here to answer questions, not complete your application for you.
Second, when you post code, either use the <pre> tag, or make sure the "Ignore HTML tags in this message (good for code snippets)" check box is checked.
Try asking a more specific question. Since you said you have been working on this 'for days', start out by telling us what you tried, and why it didn't work.
Software Zen: delete this;
|
|
|
|
|
I m the beginer in the world of VC++. I m like a 1 month old baby in this world of VC++.
I want ask u all a very basic question ie. how to call an already created dll in ur code.
I m actually developing an interface between AutoCad n SAP.
AutoCad provides runtime extensions called ARX.
Object-ARX is an API and they r a kind of dll's which r to be used to programm ur Autocad Appllication.
So start with this project of mine I very first need to understand how to use dll's in ur code.
Plssssssssss somebody on forum who knows the answer reply me
waiting for a reply
namy
|
|
|
|
|
namy31 wrote: I want ask u all a very basic question ie. how to call an already created dll in ur code.
They are dll's or a 'kind of dll' ? If these files are not dll, then you cannot use them as if they were dll. It is either black or white, not 'a kind of'. You have to be sure of that before going any further.
namy31 wrote: I want ask u all a very basic question ie. how to call an already created dll in ur code.
That's not a basic question. Playing with dll is kind of tricky if you don't have a lot of experience (and 1 month programing in C++ is very very small). There are a bunch of articles here[^] that you can have a look at. Just to have a litle bit more knowledge about what is a dll.
A question now: what do you have exactly ? A dll file, but is there a .lib file and header file supplied with it ?
Or you just have the dll alone ? In that case you will need to know exactly the names of the function names and their prototypes (that is, the number and the types of the arguments of your function)
|
|
|
|
|
See Here[^] and Here[^] maybe it is some helpful to you
|
|
|
|
|
I m the beginer in the world of VC++. I m like a 1 month old baby in this world of VC++.
I want ask u all a very basic question ie. how to call an already created dll in ur code.
I m actually developing an interface between AutoCad n SAP.
AutoCad provides runtime extensions called ARX.
Object-ARX is an API and they r a kind of dll's which r to be used to programm ur Autocad Appllication.
So to start with this project of mine I very first need to understand how to use dll's in ur code.
Plssssssssss somebody on forum who knows the answer reply me
waiting for a reply
namy
|
|
|
|
|
|
IMHO ,
#include "stdafx.h" at the top would fix the problem
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Is it possible to write your error?
|
|
|
|
|
Please read my next message
SnaidiS(Semion)
|
|
|
|
|
I tried another registry class (because I found it easier to use) but I have another problem there:
I'm writing this:
<br />
CRegistry Reg();<br />
CString string = "Software\\MyApp\\key";<br />
Reg.SetRootKey(HKEY_LOCAL_MACHINE);<br />
Reg.SetKey(string,TRUE);<br />
and it gives me the error:
error C2228: left of '.SetKey' must have class/struct/union type
article:
http://www.codeproject.com/system/registry.asp[^]
What is the problem?
-- modified at 9:28 Thursday 27th July, 2006
|
|
|
|
|
What problem with this code
<br />
CRegistry Reg;<br />
CString string2 = "Software\\MyApp\\key";<br />
Reg.SetRootKey(HKEY_LOCAL_MACHINE);<br />
Reg.SetKey(string2,TRUE);<br />
<br />
|
|
|
|
|
If I remove the ( ) it gives me a lot of errors:
MyReg error LNK2019: unresolved external symbol "public: __thiscall CRegistry::~CRegistry(void)" (??1CRegistry@@QAE@XZ) referenced in function "protected: virtual int __thiscall CMyRegDlg::OnInitDialog(void)" (?OnInitDialog@CMyRegDlg@@MAEHXZ)
MyReg error LNK2019: unresolved external symbol "public: __thiscall CRegistry::CRegistry(void)" (??0CRegistry@@QAE@XZ) referenced in function "protected: virtual int __thiscall CMyRegDlg::OnInitDialog(void)" (?OnInitDialog@CMyRegDlg@@MAEHXZ)
MyReg error LNK2019: unresolved external symbol "public: int __thiscall CRegistry::SetKey(class ATL::CStringT<char,class strtraitmfc_dll<char,class="" atl::chtraitscrt<char=""> > >,int)" (?SetKey@CRegistry@@QAEHV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@H@Z) referenced in function "protected: virtual int __thiscall CMyRegDlg::OnInitDialog(void)" (?OnInitDialog@CMyRegDlg@@MAEHXZ)
MyReg error LNK2019: unresolved external symbol "public: int __thiscall CRegistry::SetRootKey(struct HKEY__ *)" (?SetRootKey@CRegistry@@QAEHPAUHKEY__@@@Z) referenced in function "protected: virtual int __thiscall CMyRegDlg::OnInitDialog(void)" (?OnInitDialog@CMyRegDlg@@MAEHXZ)
MyReg fatal error LNK1120: 4 unresolved externals
SnaidiS(Semion)
|
|
|
|
|