|
sujandasmahapatra wrote: Howelse would that be achieved except dll.
This has nothing to do with DLLs; I can only repeat: this is not the way to do it, DLLs are shared libraries not stand alone applications. If you want to launch a second application from a first then use one of the proper API functions[^].
|
|
|
|
|
window handle is creaeing all the problem check this I am trying to get the handle like this
[code]
HWND h = this->m_hWnd;
[/code]
from the dialog class.....This is giving problem.....PLease tell me how can I get the window handle from dialog class. HWND handle. If I get the correct handle then it'll launch the application. Thanks Sujan
|
|
|
|
|
Sorry, but I don't understand what you are saying. The last few messages you were trying to launch an MFC application held inside a DLL, and now you seem to be doing something else that does not make sense. Where does this dialog fit in to what you have been talking about? And you still have not figured out how to add <pre> tags around your code!
|
|
|
|
|
HWND is a public member of CDialog -- you can access it just like any other member of CDialog class.
HWND CMyDialog::GetHandle()
{
return m_hWnd;
}
|
|
|
|
|
Yet_another_Coder_Dude wrote: HWND is a public member of CDialog
No, HWND is a type defined in Windows.h.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
when I try to access the m_hWnd from my dialog it says "unused ???"....Why is it so .
[code]
MyView::OnButtonClick()
{
HWND h = m_hWnd;
//h is coming as unsed ??? its not getting good value.
}
[/code]
Please tell me whats going wrong in this ? Thanks Sujan
|
|
|
|
|
Hey i am kinda new to C, so, can anyone suggest me a C-compiler for my 64 bit system, turbo c doesn't work, and No dosbox please, anything that is easy enough to install and use.
Thank you, in advance!
|
|
|
|
|
You could use Visual Studio and name the source file as .C
|
|
|
|
|
You could choose the free Visual C++ 2010 Express[^], which runs on 64-bit but only contains a 32-bit compiler, so cannot generate 64-bit code. GCC may offer a better option as listed here[^].
|
|
|
|
|
I want to play sound through different channels, i.e. left and right speakers independently, is there any function in C or can you outline the rough procedure of how to go about it...for e.g.
to play 440Hz through the left speaker and simultaneously play a 447 Hz sound through the right speaker, can anyone help me accomplish this??
Also, if you can help me play mp3 or wav file using C, without summoning any other program?
|
|
|
|
|
playing mp3
(Copy & paste, Save the source file as .C, not.CPP, won't compile)
#include <cstdlib>
#include <windows.h>
#pragma comment(lib, "Winmm")
#pragma comment(lib, "Vfw32")
#include <vfw.h>
#include <Mmsystem.h>
LPCWSTR lpFileName = L"c:\\file.mp3";
int wmain(int argc, char **argv)
{
PlaySound(lpFileName, NULL, SND_FILENAME);
return 0;
}
playing wav
(Copy & paste, Save the source file as .C, not.CPP won't compile)
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#pragma comment(lib,"Winmm.lib")
int main(void)
{
PlaySound("c:\\file.wav",NULL,SND_FILENAME);
return 0;
}
|
|
|
|
|
For the record, I pasted this code into a .CPP source file and it compiles with no problems.
|
|
|
|
|
You could use DirectShow[^] if your target system is Windows, it isn't exactly something one can grasp in a minute but it isn't too hard either and there are a lot of samples and documentaton, i am quite sure it can do what you want.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Hi,
How do I Create a Static Text Control with a white background in VC5.00
Regards,
Bram van Kampen
|
|
|
|
|
Have you tried responding to the WM_CTLCOLOR message, or if using MFC, the OnCtlColor() handler?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
There is an example in the following link that you can try - CWnd::OnCtlColor[^]
From the example, you do not need pDC->SetBkMode(TRANSPARENT);
Instead create a brush with the needed color and return that from the function.
|
|
|
|
|
I have created a class derived from CMFCListCtrl in VS2010. The documentation I have found says to override OnCompareItems to supply my comparison process for sorting. I have added that override. However it is never called, the default do nothing virtual is still being used. When I use Class Wizard, the virtual OnCompareItems is not listed which probably means something. Any suggestions?
|
|
|
|
|
Richard Zey wrote: However it is never called...
What are you calling to start the sort process?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I am not calling any function. I have assumed that when you click on the column header, the header control will initiate the sort. I am using the CMFCListCtry since the headr control allows mutiple column sorts and will display an up or down arrow showing the direction of the sort. I can catch the column click message and do the sorting but then I lose the two functions above.
|
|
|
|
|
Turns out that the problem is in the parameter types. The definition in afxlistctrl.h is
virtual int OnCompareItems(LPARAM lParam1, LPARAM lParam2, int iColumn);
My override was defined as
virtual int OnCompareItems(LPARAM lParam1, LPARAM lParam2, long iColumn);
As you get no error on build, I did not look closely enough.
|
|
|
|
|
I finally got my SQL Server broadcast to work, and I receive the correct data back to my socket.
bytesReceived = recv(sUDPSocket, recvbuf, recvbuflen, 0);
Now I need to get a copy of what's in the buffer, and pass it for further processing. I have learned that the buffer I made is a group of bytes, 1 char is 1 byte, so my recvbuf is set to 96.
Do I need to copy each byte 1 at at time?, or can they all be copied in one shot. If I do need to copy 1 at a time, do I use strcopy?
for ( int i = 0; bytesReceived -1; i++ ) {
strncpy ( pBuffer, recvbuf, 1 );
}
_process_SQL_BufferData(pBuffer, bytesReceived);
|
|
|
|
|
You can use strncpy[^] to copy the entire buffer at once.
strncpy (pBuffer, recvbuf, bytesReceived);
0100000101101110011001000111001011101001
|
|
|
|
|
I tried that but it only copied the first 2 bytes
char pBuffer[256]="";
strncpy (pBuffer, recvbuf, bytesReceived + 1);
_process_SQL_BufferData(pBuffer, bytesReceived);
I tried memcopy and it copied the whole thing, but I don't want to create a side effect to my receivebuffer.
char pBuffer[96];
memcpy (pBuffer, recvbuf, bytesReceived + 1);
_process_SQL_BufferData(pBuffer, bytesReceived);
|
|
|
|
|
What is the value of the bytesReceived variable?
0100000101101110011001000111001011101001
|
|
|
|
|
- recvbuf 0x0012f8a0 "T" char [256]
[0] 5 '' char
[1] 84 'T' char
[2] 0 char
[3] 83 'S' char
[4] 101 'e' char
[5] 114 'r' char
[6] 118 'v' char
[7] 101 'e' char
[8] 114 'r' char
[9] 78 'N' char
[10] 97 'a' char
[11] 109 'm' char
[12] 101 'e' char
[13] 59 ';' char
[14] 68 'D' char
[15] 69 'E' char
[16] 76 'L' char
[17] 76 'L' char
[18] 67 'C' char
[19] 53 '5' char
[20] 50 '2' char
[21] 49 '1' char
[22] 45 '-' char
[23] 48 '0' char
[24] 49 '1' char
[25] 59 ';' char
[26] 73 'I' char
[27] 110 'n' char
[28] 115 's' char
[29] 116 't' char
[30] 97 'a' char
[31] 110 'n' char
[32] 99 'c' char
[33] 101 'e' char
[34] 78 'N' char
[35] 97 'a' char
[36] 109 'm' char
[37] 101 'e' char
[38] 59 ';' char
[39] 83 'S' char
[40] 81 'Q' char
[41] 76 'L' char
[42] 69 'E' char
[43] 88 'X' char
[44] 80 'P' char
[45] 82 'R' char
[46] 69 'E' char
[47] 83 'S' char
[48] 83 'S' char
[49] 59 ';' char
[50] 73 'I' char
[51] 115 's' char
[52] 67 'C' char
[53] 108 'l' char
[54] 117 'u' char
[55] 115 's' char
[56] 116 't' char
[57] 101 'e' char
[58] 114 'r' char
[59] 101 'e' char
[60] 100 'd' char
[61] 59 ';' char
[62] 78 'N' char
[63] 111 'o' char
[64] 59 ';' char
[65] 86 'V' char
[66] 101 'e' char
[67] 114 'r' char
[68] 115 's' char
[69] 105 'i' char
[70] 111 'o' char
[71] 110 'n' char
[72] 59 ';' char
[73] 49 '1' char
[74] 48 '0' char
[75] 46 '.' char
[76] 53 '5' char
[77] 48 '0' char
[78] 46 '.' char
[79] 49 '1' char
[80] 54 '6' char
[81] 48 '0' char
[82] 48 '0' char
[83] 46 '.' char
[84] 49 '1' char
[85] 59 ';' char
[86] 59 ';' char
|
|
|
|