本文整理汇总了C++中sendmessage函数的典型用法代码示例。如果您正苦于以下问题:C++ sendmessage函数的具体用法?C++ sendmessage怎么用?C++ sendmessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendmessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: richeditfind
static int richeditfind(HWND hwnd, char *what, int matchcase,
int wholeword, int down)
{
long start, end;
CHARRANGE sel;
WPARAM w = 0;
FINDTEXTEX ft;
sendmessage (hwnd, EM_EXGETSEL, 0, &sel) ;
start = sel.cpMin;
end = sel.cpMax;
ft.lpstrText = what;
ft.chrgText.cpMin = start;
ft.chrgText.cpMax = end;
if (down) {
w = w | FR_DOWN;
ft.chrg.cpMin = end;
ft.chrg.cpMax = -1;
}
else {
ft.chrg.cpMin = start;
ft.chrg.cpMax = 0;
}
if (matchcase) w = w | FR_MATCHCASE;
if (wholeword) w = w | FR_WHOLEWORD;
if (sendmessage(hwnd, EM_FINDTEXTEX, w, &ft) == -1)
return 0;
else {
sendmessage (hwnd, EM_EXSETSEL, 0, &(ft.chrgText));
sendmessage (hwnd, EM_SCROLLCARET, 0, 0) ;
}
return 1;
}
示例2: setlistitem
void setlistitem(listbox obj, int index)
{
int count;
if (! obj)
return;
if (index < 0)
index = -1;
switch (obj->kind)
{
case ListboxObject:
sendmessage(obj->handle, LB_SETCURSEL, index, 0L);
break;
case MultilistObject:
if (index >= 0)
sendmessage(obj->handle, LB_SETSEL, TRUE, MAKELPARAM(index, 0));
else {
count = sendmessage(obj->handle, LB_GETCOUNT, 0, 0L);
sendmessage(obj->handle, LB_SELITEMRANGE, FALSE, MAKELPARAM(0,count-1));
}
case DroplistObject:
case DropfieldObject:
sendmessage(obj->handle, CB_SETCURSEL, index, 0L);
break;
default:
break;
}
}
示例3: handle_findreplace
PROTECTED
void handle_findreplace(HWND hwnd, LPFINDREPLACE pfr)
{
CHARRANGE sel;
int matchcase=0, wholeword=0, down=0;
char buf[100];
if (pfr->Flags & FR_MATCHCASE) matchcase = 1;
if (pfr->Flags & FR_WHOLEWORD) wholeword = 1;
if (pfr->Flags & FR_DOWN) down = 1;
if (pfr->Flags & FR_FINDNEXT) {
if (!richeditfind(hwnd, pfr->lpstrFindWhat, matchcase, wholeword, down)) {
snprintf(buf, 100, G_("\"%s\" not found"), pfr->lpstrFindWhat);
askok(buf);
}
}
else if (pfr->Flags & FR_REPLACE) {
if (!richeditreplace(hwnd, pfr->lpstrFindWhat, pfr->lpstrReplaceWith, matchcase, wholeword, down)) {
snprintf(buf, 100, G_("\"%s\" not found"), pfr->lpstrFindWhat);
askok(buf);
}
}
else if (pfr->Flags & FR_REPLACEALL) {
/* replace all in the whole buffer then return to original selection state */
sendmessage (hwnd, EM_EXGETSEL, 0, &sel) ;
sendmessage (hwnd, EM_SETSEL, 0, 0) ;
while ( richeditreplace(hwnd, pfr->lpstrFindWhat, pfr->lpstrReplaceWith, matchcase, wholeword, down) ) ;
sendmessage (hwnd, EM_EXSETSEL, 0, &sel) ;
}
else if (pfr->Flags & FR_DIALOGTERM)
hModelessDlg = NULL;
}
示例4: load_hoststatus
static void load_hoststatus()
{
int res;
char msg[1024];
sendreturn_t *sres;
sprintf(msg, "xymondboard fields=hostname,testname,color test=%s", conncolumn);
sres = newsendreturnbuf(1, NULL);
res = sendmessage(msg, NULL, XYMON_TIMEOUT, sres);
if (res == XYMONSEND_OK) connstatus = getsendreturnstr(sres, 1);
if ((res == XYMONSEND_OK) && testcolumn) {
sprintf(msg, "xymondboard fields=hostname,testname,color test=%s", testcolumn);
res = sendmessage(msg, NULL, XYMON_TIMEOUT, sres);
if (res == XYMONSEND_OK) teststatus = getsendreturnstr(sres, 1);
}
if (res != XYMONSEND_OK) {
errprintf("Cannot fetch Xymon status, ignoring --no-down\n");
connstatus = NULL;
teststatus = NULL;
}
freesendreturnbuf(sres);
}
示例5: changelistbox
void changelistbox(listbox obj, char **list)
{
int i;
HWND hwnd;
UINT reset_msg, add_msg;
if (! obj)
return;
hwnd = obj->handle;
switch (obj->kind) {
case ListboxObject: case MultilistObject:
reset_msg = LB_RESETCONTENT;
add_msg = LB_ADDSTRING;
break;
case DroplistObject: case DropfieldObject:
reset_msg = CB_RESETCONTENT;
add_msg = CB_ADDSTRING;
break;
default:
return;
}
sendmessage(hwnd, WM_SETREDRAW, FALSE, 0L);
sendmessage(hwnd, reset_msg, 0, 0L);
for (i=0; list && list[i]; i++)
sendmessage(hwnd, add_msg, 0, (LPSTR) list[i]);
sendmessage(hwnd, WM_SETREDRAW, TRUE, 0L);
if (obj->kind == ListboxObject)
sendmessage(hwnd, LB_SETCURSEL, 0, 0L);
}
示例6: richeditreplace
static int richeditreplace(HWND hwnd, char *what, char *replacewith,
int matchcase, int wholeword, int down)
{
/* If current selection is the find string, replace it and find next */
long start, end;
CHARRANGE sel;
char *buf;
textbox t = find_by_handle(hwnd);
if (t) {
sendmessage (hwnd, EM_EXGETSEL, 0, &sel) ;
start = sel.cpMin;
end = sel.cpMax;
if (start < end) {
buf = (char *) malloc(end - start + 1);
sendmessage(hwnd, EM_GETSELTEXT, 0, buf);
if (!strcmp(buf, what)) {
checklimittext(t, strlen(replacewith) - strlen(what) + 2);
sendmessage (hwnd, EM_REPLACESEL, 1, replacewith);
}
free(buf);
}
/* else just find next */
if (richeditfind(hwnd, what, matchcase, wholeword, down))
return 1;
}
return 0;
}
示例7: setl2
/*
* Set the layer 2 protocol (X.25, HDLC, Raw)
*/
static int setl2(int card, unsigned long arg)
{
int status =0;
int protocol,channel;
if(!IS_VALID_CARD(card)) {
pr_debug("Invalid param: %d is not a valid card id\n", card);
return -ENODEV;
}
protocol = arg >> 8;
channel = arg & 0xff;
sc_adapter[card]->channel[channel].l2_proto = protocol;
/*
* check that the adapter is also set to the correct protocol
*/
pr_debug("%s: Sending GetFrameFormat for channel %d\n",
sc_adapter[card]->devicename, channel+1);
status = sendmessage(card, CEPID, ceReqTypeCall,
ceReqClass0,
ceReqCallGetFrameFormat,
(unsigned char)channel+1,
1,
(unsigned int *) protocol);
if(status)
return status;
return 0;
}
示例8: zvm_mdc_report
static void zvm_mdc_report(char *hostname, char *clientclass, enum ostype_t os,
void *hinfo, char *fromline, char *timestr, char *cpuutilstr)
{
char *p;
int mdcreads, mdcwrites, mdchitpct;
char mdcresult[100];
char msgline[256];
strbuffer_t *msg;
if (!cpuutilstr) return;
msg = newstrbuffer(0);
/*
* Looking for MDC info in 'IND' command response
* MDC READS-000001/SEC WRITES-000001/SEC HIT RATIO-098%
*/
*mdcresult = '\0';
/* Skip past three newlines in message to the PAGING text */
p=strstr(cpuutilstr,"READS-");
if (p) {
p += 6;
sscanf(p, "%d/SEC", &mdcreads);
p=strstr(cpuutilstr,"WRITES-") + 7;
sscanf(p, "%d/SEC", &mdcwrites);
p=strstr(cpuutilstr,"RATIO-") + 6;
sscanf(p, "%d", &mdchitpct);
sprintf(msgline, "data %s.mdc\n%s\n%d:%d:%d\n", commafy(hostname), osname(os), mdcreads, mdcwrites, mdchitpct);
addtobuffer(msg, msgline);
sendmessage(STRBUF(msg), NULL, BBTALK_TIMEOUT, NULL);
}
freestrbuffer(msg);
}
示例9: sendmessage
void dumbmover::update()
{
if(movepath.getsize() == 0)
{
movepath.calculate(position, position + delta);
movepath.pop_front();
}
if(movepath.getsize() != 0)
{
movepoints += speed;
if(movepoints > 100)
{
movepoints -= 100;
ivec2 moveposition = movepath.getcurrent();
message msg;
msg.set("changeposition",1);
msg.set("x",moveposition.getx());
msg.set("y",moveposition.gety());
sendmessage(msg);
movepath.pop_front();
if(getregistry()->checkposition(moveposition))
{
component::killhost();
}
}
}
}
示例10: dial
/*
* Dials the number passed in
*/
static int dial(int card, unsigned long channel, setup_parm setup)
{
int status;
char Phone[48];
if(!IS_VALID_CARD(card)) {
pr_debug("Invalid param: %d is not a valid card id\n", card);
return -ENODEV;
}
/*extract ISDN number to dial from eaz/msn string*/
strcpy(Phone,setup.phone);
/*send the connection message*/
status = sendmessage(card, CEPID,ceReqTypePhy,
ceReqClass1,
ceReqPhyConnect,
(unsigned char) channel+1,
strlen(Phone),
(unsigned int *) Phone);
pr_debug("%s: Dialing %s on channel %lu\n",
sc_adapter[card]->devicename, Phone, channel+1);
return status;
}
示例11: send_data
void send_data(void *host, char *beadomain, char *databuf, char **items)
{
bea_idx_t *idxwalk;
strbuffer_t *msgbuf;
char *p;
int i;
msgbuf = newstrbuffer(0);
for (idxwalk = bea_idxhead; (idxwalk); idxwalk = idxwalk->next) {
sprintf(msgline, "data %s.bea\n\n", commafy(bbh_item(host, BBH_HOSTNAME)));
addtobuffer(msgbuf, msgline);
if (beadomain && *beadomain) {
sprintf(msgline, "DOMAIN:%s\n", beadomain);
addtobuffer(msgbuf, msgline);
}
for (i=0; (items[i]); i++) {
p = getstring(databuf, idxwalk->idx, items[i]);
sprintf(msgline, "%s\n", p);
addtobuffer(msgbuf, msgline);
}
sendmessage(STRBUF(msgbuf), NULL, BBTALK_TIMEOUT, NULL);
clearstrbuffer(msgbuf);
}
freestrbuffer(msgbuf);
}
示例12: combo_flush
static void combo_flush(void)
{
if (!xymonmsgqueued) {
dbgprintf("Flush, but xymonmsg is empty\n");
return;
}
if (debug) {
char *p1, *p2;
dbgprintf("Flushing combo message\n");
p1 = p2 = STRBUF(xymonmsg);
do {
p2++;
p1 = strstr(p2, "\nstatus ");
if (p1) {
p1++; /* Skip the newline */
p2 = strchr(p1, '\n');
if (p2) *p2='\0';
printf(" %s\n", p1);
if (p2) *p2='\n';
}
} while (p1 && p2);
}
sendmessage(STRBUF(xymonmsg), NULL, XYMON_TIMEOUT, NULL);
combo_start(); /* Get ready for the next */
}
示例13: main
int main(int argc, char const **argv)
{
arg_check(argc);
int socket_fd, recv, len;
char msg[6] = "hello";
char response[MSG_SIZE_CLIENT], server_port[6], server_ip[40];
struct timeval times[3];
struct sockaddr_storage server_addr;
struct addrinfo hints, *res;
fd_set read_set;
bzero(response, sizeof response);
resolve(server_ip, argv[1]);
setup(&socket_fd, &hints, res, server_ip, server_port, &server_addr, &len);
fd_clear_set(&socket_fd, &read_set);
sendmessage(&socket_fd, &msg[0], (struct sockaddr *) &server_addr, len, times);
recv = waitresponse(socket_fd, &read_set, times[2]);
getresults1(recv, socket_fd, &response[0], times);
close(socket_fd);
}
示例14: getboard
static int getboard(int mincolor)
{
char msg[1024];
int i;
sendreturn_t *sres;
int xymondresult;
if (!boardmaster) {
sprintf(msg, "xymondboard acklevel=%d fields=hostname,testname,color,lastchange,logtime,validtime,acklist color=%s", critacklevel,colorname(mincolor));
for (i=mincolor+1; (i < COL_COUNT); i++) sprintf(msg+strlen(msg), ",%s", colorname(i));
sres = newsendreturnbuf(1, NULL);
xymondresult = sendmessage(msg, NULL, XYMON_TIMEOUT, sres);
if (xymondresult != XYMONSEND_OK) {
boardmaster = "";
freesendreturnbuf(sres);
errormsg("Unable to fetch current status\n");
return 1;
}
else {
boardmaster = getsendreturnstr(sres, 1);
freesendreturnbuf(sres);
}
}
return 0;
}
示例15: main
int main(int argc, const char * argv[]) {
// insert code here...
int matrix[4][4];
sendmessage();
receiver();
return 0;
}